none
Help with this problem RRS feed

  • Question

  • So, currently I'm trying to connect two camera together, but if I change the Private function that has the connect to Public, I can connect the one but when I try to connect the second one it retains the information from the first cameras settings. Any ideas on how to connect both simultaneously. That's issue 1. Issue 2 is I'm trying to trigger the camera off a barcode scan input. But, can't seem to get that to function. Seems to either error out or timeout. Any help or suggests are welcome. 

    On a side note, how does one get a function that is tied to the button to work when the function has no handle for connect. Any help would be appreciated.

    P.S. This software is a undeveloped SDK. It's pretty raw.

    Wednesday, May 1, 2019 8:06 PM

All replies

  • Hi

    What ever you do, do NOT show us any code - otherwise you would be in danger of getting an answer.


    Regards Les, Livingston, Scotland

    Wednesday, May 1, 2019 8:17 PM
  • My bad, it must have never moved over after I lost it the first time. 
    	Private Sub UpdateControls()
    		Dim sensorEnable As Boolean = sensor IsNot Nothing
    		panelOperation.Enabled = sensorEnable
    		ipAddressControl.Enabled = Not sensorEnable
    		buttonConnect.Enabled = Not sensorEnable
    		buttonDisconnect.Enabled = sensorEnable
    		checkBoxEvent.Checked = sensorEnable AndAlso sensor.EventEnable
    		timer.Enabled = sensorEnable
    		buttonImportProgram.Enabled = sensorEnable AndAlso TypeOf sensor Is IVisionSensorIVHSeries
    	End Sub
    
    	Private Sub ButtonConnectClick(sender As Object, e As EventArgs)
    		If Not ipAddressControl.EnableAddress Then
    			Return
    		End If
    		UpdateVisionSensorObject()
    		SetupVisionSensorViewer()
    		UpdateControls()
    	End Sub
    
    	Private Sub UpdateVisionSensorObject()
    		If UpdateVisionSensorIVHSeriesObject() Then
    			Return
    		End If
    		Try
    			sensor = store.Create(ipAddressControl.IpAddress, ipAddressControl.PortNo)
    		Catch e As InvalidOperationException
    			' You may have tried to create same VisionSensor object before disposing it.
    			MessageBox.Show(e.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.[Error])
    			Return
    		Catch e As ConnectionLostException
    			MessageBox.Show(e.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.[Error])
    			Return
    		End Try
    	End Sub
    
    	Private Function UpdateVisionSensorIVHSeriesObject() As Boolean
    		Try
    			sensor = store.CreateIVHSeries(ipAddressControl.IpAddress, ipAddressControl.PortNo)
    		Catch generatedExceptionName As InvalidOperationException
    			Return False
    		Catch generatedExceptionName As ConnectionLostException
    			Return False
    		End Try
    		Return True
    	End Function
    
    	Private Sub SetupVisionSensorViewer()
    		If sensor Is Nothing Then
    			Return
    		End If
    		imageDisplayControl.Initialize(sensor)
    		sensorIdentificationDisplayControl.Initialize(sensor)
    		resultDisplayControl.Initialize(sensor)
    		programSettingsDisplayControl.Initialize(sensor)
    		programListDisplayControl.Initialize(sensor)
    		errorStatusDisplayControl.Initialize(sensor)
    
    		AddHandler programListDisplayControl.ConnectionLost, AddressOf Disconnect
    		AddHandler errorStatusDisplayControl.ConnectionLost, AddressOf Disconnect
    	End Sub
    
    
    
    'Part 2:
    Private Sub ButtonTriggerClick(sender As Object, e As EventArgs)
    			Try
    				sensor.Trigger()
    			Catch generatedExceptionName As ConnectionLostException
    				RaiseEvent ConnectionLost(Me, EventArgs.Empty)
    			End Try
    		End Sub

    Wednesday, May 1, 2019 8:30 PM
  • Hi

    Thanks for posting code. Now, where is the issue within the code?

    Please do not refer to part of code as 'the Private function .....", but use the Function name - otherwise, it is a lot of work here just finding 'the Function ....'

    Have you tried setting breakpoints and stepping through code to determine where an issue is occurring?

    *

    'On a side note, how does one get a function that is tied to the button to work when the function has no handle for connect.'

    in what way is a function 'tied' to a button? What is the 'handle' of a function?


    Regards Les, Livingston, Scotland

    Wednesday, May 1, 2019 9:05 PM
  • Is this not the same as this question or if not extremely similar and seems that you would stick with the first question?

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/35cee6f8-cbb4-4e40-8646-55eaebffff0d/accessing-a-private-function-in-a-user-control-to-another-form?forum=vbgeneral#ce64fe34-89fc-4944-9bd2-048324872d9e


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, May 1, 2019 11:01 PM
    Moderator
  • Well, since that question I asked it had gone dead on assistance. SO, I thought why not try again to see if any others could be of help.
    Thursday, May 2, 2019 11:46 AM
  • The ButtonConnectClick Function is tied to the Connect Button the form to my knowledge. And when I tired to set breakpoints it crashes so that's really not an option right now. 
    Thursday, May 2, 2019 11:48 AM
  • The ButtonConnectClick Function is tied to the Connect Button the form to my knowledge. And when I tired to set breakpoints it crashes so that's really not an option right now

    Hi

    Are you unclear of the points I made previously? What does the phrase 'tied to' mean?

    *

    'so that's really not an option right now' well, I would imagine you are all out of options then.

    *

    Is this code something you found online and copy/pasted?


    Regards Les, Livingston, Scotland


    • Edited by leshay Thursday, May 2, 2019 12:18 PM
    Thursday, May 2, 2019 12:17 PM
  • Well, since that question I asked it had gone dead on assistance. SO, I thought why not try again to see if any others could be of help.

    There are always reasons for a post to go dead and this can be for many reasons. Most of the time it does not help to create a new post.



    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, May 2, 2019 12:23 PM
    Moderator