BreakTheSilence
New member
- Joined
- May 28, 2006
- Messages
- 3
- Programming Experience
- Beginner
accessing form objects from a sub routine
Hello im new to vb and i working on writing an sub routine that will access form objects based on a value that was passed to the sub.
For example:
Public sub check1_CheckedChanged
sub_routine(1)
end sub
Public sub_routine(location as string)
text + location.text = "something" < ----- this is my problem
end sub
Result: text1.text would now say "something"
I dont know how to call the object with its base name and a variable. I know its something simple and i am looking way to deep into it but i cant figure it out. Any help would be Great!!!!
Here is my source code:
My temp variables are not working; i get a error message saying "missingmemberexception was unhandled" "public member 'Checked' on type 'String' not found".
Any help would great...thanks!
- Jesse
Hello im new to vb and i working on writing an sub routine that will access form objects based on a value that was passed to the sub.
For example:
Public sub check1_CheckedChanged
sub_routine(1)
end sub
Public sub_routine(location as string)
text + location.text = "something" < ----- this is my problem
end sub
Result: text1.text would now say "something"
I dont know how to call the object with its base name and a variable. I know its something simple and i am looking way to deep into it but i cant figure it out. Any help would be Great!!!!
Here is my source code:
VB.NET:
Public Sub openaudiofile(ByVal location As String)
Dim Temp_textbox
Dim Temp_checkbox
Dim Temp_array
Temp_textbox = "txtaudio" & location
Temp_checkbox = "chkaudio" & location
Temp_array = ArrayOfAudio(location)
If Temp_checkbox.Checked = True Then <---- ERROR starts here
Temp_textbox.Enabled = True
Temp_textbox.Text = ""
If frmmain.ofd1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Temp_array = frmmain.ofd1.FileName
Temp_textbox = frmmain.ofd1.FileName
Else
Temp_textbox.Enabled = False
Temp_array = ""
Temp_textbox.Text = ""
Temp_checkbox.Checked = False
End If
Else
Temp_textbox.Enabled = False
Temp_array = ""
Temp_textbox.Text = ""
End If
End Sub
Any help would great...thanks!
- Jesse
Last edited: