gunslinger
Member
- Joined
- Dec 19, 2005
- Messages
- 5
- Programming Experience
- 1-3
because ms in their great wisdom got rid of control arrays, my simple graphic keyboard (developed for touchscreens that i often use) needs to be recoded completely when it comes to .net.
so, rant over. here is a small portion of what I am trying to do. my projects generally go to industrial sites (pharmaceutical, chemical etc.) so I have to provide absolute guaruntees that data entered is valid. so depending on the circumstances I may want to disable the alphabetic buttons on my graphic keyboard, or the numeric ones or the other keys (!"£$%^:<. etc).
I have a windows form with loads of buttons on. The buttons share a common event handler.
so I have the following code (as a snippet)
I keep getting an error when I run my code and then load tye keyboard form. the error is "Object reference not set to an instance of an object" and when I debug myButton is set to nothing.
Anyone have any ideas, or I am I using the syntax incorrectly?
gunslinger
so, rant over. here is a small portion of what I am trying to do. my projects generally go to industrial sites (pharmaceutical, chemical etc.) so I have to provide absolute guaruntees that data entered is valid. so depending on the circumstances I may want to disable the alphabetic buttons on my graphic keyboard, or the numeric ones or the other keys (!"£$%^:<. etc).
I have a windows form with loads of buttons on. The buttons share a common event handler.
so I have the following code (as a snippet)
VB.NET:
'private
'an array that holds the buttons that I have deemed as alphabetic)
Private alphabeticCharacters() As Button = {bttn13, bttn14, bttn15, bttn16, bttn17, bttn18, bttn19, bttn20, bttn21, bttn22, bttn25, bttn26, bttn27, bttn28, bttn29, bttn30, bttn31, bttn32, bttn33, bttn38, bttn39, bttn40, bttn41, bttn42, bttn43, bttn44}
'public
'a variable that is initially false but can be set later
Dim disableAlphabeticCharacters As Boolean = False
'now the code for disabling lots of buttons from my array.
For i As Integer = 0 To alphabeticCharacters.Length
'create a temporary button object.
Dim myButton As New Button
'point the temporary button object to the relavant slot in the
'alphabeticCharacter array.
myButton = alphabeticCharacters(i)
'set the status of the temporary button.
myButton.enabled = not disableAlphabeticCharacters
Next
Anyone have any ideas, or I am I using the syntax incorrectly?
gunslinger