I load all the files into a 2-dimensional array (below), from which I want
to populate the comboboxes.
cmb1 cmb2 cmb3
green apple sour
red pear sweet
yellow peach tart
I want to be able to reference the object by the string name, e.g. something
like:
Me.control("cmb1").additem
but if that isn't possible, I guess there must be a way to cycle/loop
through all the controls (yuck) and find the one with the right name. I
tried adapting the following, but it was not from a compact framework group,
and I have been unsuccessful at adapting it to my needs:
ttp://groups.google.de/groups?selm=%23kGYk5IgDHA.164%40tk2msftngp13.phx.gbl>
(note the last bracket '>' is required, but not part of the link for some
reason)
I also found:
http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=u48XpTttCHA
.2492%40TK2MSFTNGP10&rnum=12&prev=/groups%3Fq%3D%2Bcontrol%2BOR%2Bcombobox%2
Bgroup:microsoft.public.dotnet%26start%3D10%26hl%3Den%26lr%3D%26ie%3DUTF-8%2
6oe%3DUTF-8%26selm%3Du48XpTttCHA.2492%2540TK2MSFTNGP10%26rnum%3D12
but the first response (which seemed the most relevant) is still not
decipherable to me
Any and all help would be greatly appreciated!
Keith
Imports System.Reflection
Private Function GetControlByName(ByVal name As String) As Control
Return DirectCast(Me.GetType().GetField(name, BindingFlags.NonPublic Or
BindingFlags.Public Or BindingFlags.Instance Or
BindingFlags.IgnoreCase).GetValue(Me), Control)
End Function
GetControlByName("_TextBox1").Text = "42"
DirectCast(GetControlByName("_ComboBox1"), ComboBox).Items.Add("42")
Make sure to add the underscore to the control name when you address it (not
needed in C#)
"K Ruck" <nos...@columbus.rr.com> wrote in message
news:OTfes4ok...@TK2MSFTNGP10.phx.gbl...