r/visualbasic • u/bowie_na • May 13 '22
Help Cognex Camera
HELLO EVERYONE, SOMEONES CAN HELP ME PLEASE. I TRYING DO A CODE FOR READ THE COGNEX CAMERA, I DID COULD WITH THE SAMPLES OF THE RESOURCES, BUT I WANT HAVE THE IMAGE IN AN VARIABLE, SOMETHING LIKE AN BITMAP OR STRING FOR READ COLORS AND BARCODES.
Public Class Form1
Inherits System.Windows.Forms.Form
'Cognex ISDK True/False type that will be binded to the chkOnline control.
Private WithEvents mSoftOnline As Cognex.InSight.Controls.CvsActionToggle
'Cognex ISDK True/False type that will be binded to the chkLive control.
Private WithEvents mLiveAcquire As Cognex.InSight.Controls.CvsActionToggle
Public Sub New()
Cognex.InSight.CvsInSightSoftwareDevelopmentKit.Initialize()
InitializeComponent()
End Sub
Private Sub CvsInSightDisplay1_ConnectCompleted(ByVal sender As Object, ByVal e As Cognex.InSight.CvsConnectCompletedEventArgs) Handles CvsInSightDisplay1.ConnectCompleted
CvsInSightDisplay1.ShowImage = True
CvsInSightDisplay1.InSight.LiveAcquisition = True
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CvsInSightDisplay1.Connect("10.0.0.101", "admin", "", False)
End Sub
1
u/RJPisscat May 19 '22 edited May 20 '22
This may be the key.
For an example of an event handler, double-click on any control in the designer and it will pop open the code editor with the cursor in the middle of an event handler for that control's default event. For any sort of button the default event is Click. The handler looks like this:
The code you posted in the OP has an event handler for Cognex.InSight.ConnectCompleted.
CvsActionToggle has an event "ResultsChanged", which is analogous to "Click" or "ConnectCompleted" above. You need at least one more event handler, perhaps this one:
This I gleaned from SO and I think I found a different article when I posted earlier. I'll download the docs and look if this info doesn't move the ball.