I migrated a VB.NET application to Visual Studio 2019 and need to connect to a Cognex In-Sight camera (7802) and return the image/images. I have looked at some of their demos. I have added some code to connect to the form with the control and code to get the data to the calling program. I do not yet have the camera and its software loaded, yet. I am being proactive to get any help.

Does anyone have any code that they could share?

Thank you.

Here is some code I have:
To get the image:
Dim CI As New CognexImage
Dim sImageName As String = String.Empty

If CI.ShowDialog() = DialogResult.OK Then
CI.ForceConnection(m_CognexIpAddress)
sImageName = "_" & CI.ImageName
End If

In the form with the camera control:
' Force connection to the display control. This will force the "ConnectCompleted" event to be triggered.
' The display control will use the textbox values if they are filled in or default values if they are not.
Public Sub ForceConnection(IPAddress As String)
Dim strIPAddress As String = String.Empty
Dim strUserName As String = String.Empty
Dim strPassword As String = String.Empty

If Not String.IsNullOrEmpty(txtAddress.Text) Then
strIPAddress = txtAddress.Text
Else
strIPAddress = IPAddress
End If
If Not String.IsNullOrEmpty(txtUserName.Text) Then
strUserName = txtUserName.Text
Else
strUserName = "admin"
End If
If Not String.IsNullOrEmpty(txtPassword.Text) Then
strPassword = txtPassword.Text
Else
strPassword = String.Empty
End If

If Not CvsInSightDisplay1.Connected Then
'cmdConnect.Enabled = False
CvsInSightDisplay1.Connect(strIPAddress, strUserName, strPassword, False)
'chkImage.Checked = CvsInSightDisplay1.ShowImage
Else
CvsInSightDisplay1.Disconnect()
End If
'Refresh()
End Sub

In the CvsInSightDisplay1_ConnectCompleted event handler:
CvsInSightDisplay1.SaveBitmap(m_imageName)