cyberbiker
Programmer
New to VB.net and am becoming confused with event handlers.
I have looked through the posts for a bit and realize that control arrays do not exist in VB.net.
The question I have is that I do not seem to quite understand how to use the event handler to handle something like this (from VB6)
Private sub cmdButton_Click(Index as integer)
select case index
case 1
' call a sub and do something
case 2
'call a sub and do something totally different
case 3
'open something
case 4
'close something
case else
'display error message
end select
If I understand correctly I would not be able to do this in VB.net.
Instead I would either need to put the applicable code in the event handler (in this case the click event) of each control. or call a sub from each event handler.
perhaps something like this
Private sub FakeArray()
dim ctl as control
for each ctl in controls
select case ctl.tag
case "1"
etc, etc, etc
I am wondering if I am misunderstanding this somehow.
Basically, How should I handle something like the first select in VB.net?
And I have looked at the compatability controls. They look good for upgrades, but I have learned from bad experience to write code based on the "newest" and would not want to use them for new development
So far, VB.net seems to tower over VB6 and I can live without control arrays in return for the other benefits of vb.net, but I want to be certain that I understand what I am reading.
If I am not clear let me kow and I will try again.
Terry (cyberbiker)
I have looked through the posts for a bit and realize that control arrays do not exist in VB.net.
The question I have is that I do not seem to quite understand how to use the event handler to handle something like this (from VB6)
Private sub cmdButton_Click(Index as integer)
select case index
case 1
' call a sub and do something
case 2
'call a sub and do something totally different
case 3
'open something
case 4
'close something
case else
'display error message
end select
If I understand correctly I would not be able to do this in VB.net.
Instead I would either need to put the applicable code in the event handler (in this case the click event) of each control. or call a sub from each event handler.
perhaps something like this
Private sub FakeArray()
dim ctl as control
for each ctl in controls
select case ctl.tag
case "1"
etc, etc, etc
I am wondering if I am misunderstanding this somehow.
Basically, How should I handle something like the first select in VB.net?
And I have looked at the compatability controls. They look good for upgrades, but I have learned from bad experience to write code based on the "newest" and would not want to use them for new development
So far, VB.net seems to tower over VB6 and I can live without control arrays in return for the other benefits of vb.net, but I want to be certain that I understand what I am reading.
If I am not clear let me kow and I will try again.
Terry (cyberbiker)