I want to use a string to call a function. I will just post the code because I don't really know the terminology or how to program for that matter. I am using Visual Studio express.
Public Class Form1
Dim estt As New Test.Unit.Drive r.Probe
Dim c As Integer 'counter
Dim x As Integer 'sensor position
Dim rw As String 'read/write
Private Sub ReadButton_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ReadButton.Clic k
rw = "get" 'set variable to read
doit()
End Sub
Private Sub WriteButton_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles WriteButton.Cli ck
rw = "set" 'set variable to write
doit()
End Sub
Sub doit()
x = NumericUpDown1. Value
For c = NumericUpDown2. Value To NumericUpDown3. Value
Controls("textb ox" & c).Text = :mad: estt.getProbeTy pe(x) :mad:
Next
End Sub
End Class
The highlighted portion is the root of my problems. As it is written everything works for that one function. I want it to be controlled by two variables. I need the "get" portion to be the rw variable, and the "ProbeType" to be the text of the corrisponding Label (which the first one happens to be "ProbeType" ). I want it to behave like this, but it will not work Controls("textb ox" & c).Text = estt.(rw) + (controls("Labe l" & c)) + (x)
Public Class Form1
Dim estt As New Test.Unit.Drive r.Probe
Dim c As Integer 'counter
Dim x As Integer 'sensor position
Dim rw As String 'read/write
Private Sub ReadButton_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ReadButton.Clic k
rw = "get" 'set variable to read
doit()
End Sub
Private Sub WriteButton_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles WriteButton.Cli ck
rw = "set" 'set variable to write
doit()
End Sub
Sub doit()
x = NumericUpDown1. Value
For c = NumericUpDown2. Value To NumericUpDown3. Value
Controls("textb ox" & c).Text = :mad: estt.getProbeTy pe(x) :mad:
Next
End Sub
End Class
The highlighted portion is the root of my problems. As it is written everything works for that one function. I want it to be controlled by two variables. I need the "get" portion to be the rw variable, and the "ProbeType" to be the text of the corrisponding Label (which the first one happens to be "ProbeType" ). I want it to behave like this, but it will not work Controls("textb ox" & c).Text = estt.(rw) + (controls("Labe l" & c)) + (x)
Comment