kservice Posted October 26, 2004 Posted October 26, 2004 OK, here is the dumb question of the day. I have a array that is filled by a user making choices. It is currently dimmed as: Friend gstrAssemblyRemarker() As String The first time I use gstrAssemblyRemarker I get an error because it is nothing. How can I instantiate it and set a default value so that it looks like: Friend gstrAssemblyRemarker() As String = ? I cannot just check for nothing. There are 42 controls that this could apply to and I have no way of knowing which or how many will be selected. Thanks P.S. There is not a better way of doing this. I have to have 42 controls. Quote
mocella Posted October 26, 2004 Posted October 26, 2004 Why not have an array of your controls? So if you're working with textboxes, you'd do: friend myTextboxes() as Textbox = new Textbox(42) then have some startup code that assigns your textboxes into this array - myTextboxes(0) = txtSometext1 ... myTextboxes(41) = txtSometext42 There's other approaches you can take here, but if you're set on an array of controls, this should work. Quote
*Experts* DiverDan Posted October 27, 2004 *Experts* Posted October 27, 2004 If I understand your question correctly.... You could set an UpperBound value to the array Dim gstrAssemblyRemarker(0) As String With that then check the UpperBound value and if it = Nothing: If gstrAssemblyRemarker.GetUpperBound(0) = Nothing Then ....OR in a loop: For i = 0 to gstrAssemblyRemarker.GetUpperBound(0) If Not gstrAssemblyRemarker(i) = Nothing Then 'blah End If Next Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
kservice Posted October 27, 2004 Author Posted October 27, 2004 Got it. I forgot something else. Stupid, Stupid. :o Thanks for your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.