Hello!
I have a noob Q:
I'm trying to build a VB.Net command using variables at runtime.
For example, I must populate several (84) comboboxes with the same content and I must do it in several sub's. I could of course write:
Code:
Private Sub PopulateCombo()
ComboBox1.Items.Add("MyContent")
ComboBox2.Items.Add("MyContent")
ComboBox3.Items.Add("MyContent")
'...
ComboBox84.Items.Add("MyContent")
End Sub
But this seems just to cumbersome to be good programming. Instead I want to build a string, and then have Vb read the string as a command. The following code is just fantasy, but highlights what I'm trying to do:
Code:
Private Sub PopulateCombo()
Private Counter As Integer
Private Command As String = "ComboBox" + Counter +".Items.Add("MyContent")
For Counter = 1 To 84
Command.ExecuteAsCommand 'Fantasy
Next
End Sub
Get it?
Thx for any help...