Using reference in VB

blg

Joined
Feb 9, 2012
Messages
2
Reaction score
0
Hi Folks,

Simple question (to all but me I'm sure). I am trying to point to an instance of and ActiveX control using a string, but for obvious reasons it will not work...

For n As Integer = 1 To 13
Try
AxIndigoViewer1.StartVideo("192.168.8.126", 0, 0, 2)
Catch ex As Exception
MessageBox.Show("Nope on cam number " & n)
MsgBox(ex.ToString)
End Try
Try
AxIndigoViewer2.StartVideo("192.168.8.127", 0, 0, 2)
Catch ex As Exception
MessageBox.Show("Nope on cam number " & n)
MsgBox(ex.ToString)
End Try

So instead of the AxIndigoViewer1 I want "AxIndigoViewer" & n

Any thoughts?

Thanks,

blg
 
Solved...

If anyone is interested:

Dim n As Integer = 1
Dim IV(14) As AxIndigoViewer
For Each c As Control In Me.Controls
If TypeName(c) = "AxIndigoViewer" Then
Try
IV(n) = New AxIndigoViewer
IV(n) = c
IV(n).StartVideo("192.168.8.127", 0, 0, 2)
Catch ex As Exception
Debug.Print(c.Name)
End Try
n = n + 1
End If
Next
 
Back
Top