I create an array to store the radiobutton list. If the user click the 3rd
buttons,
I should store the value 2 into the table fields,
My method is check each radio button whether is checked or not,
if Me.rb1stbutton.checked than .. store 0
if Me.rb2..... checked then store 1
.........
if Me.rb6... checked then store 5.
Any other simple method to know which button is checked ? thanks a lot 8 7854
Note a handler can handle more than one event, you can determine the
sender's name within the handler. The example here handler all three boxes.
Alternatively you can have a handler for each
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles RadioButton1.CheckedChanged,
RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
End Sub
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl... I create an array to store the radiobutton list. If the user click the
3rd buttons, I should store the value 2 into the table fields, My method is check each radio button whether is checked or not, if Me.rb1stbutton.checked than .. store 0 if Me.rb2..... checked then store 1 ........ if Me.rb6... checked then store 5.
Any other simple method to know which button is checked ? thanks a lot
I know handler can handler many event. but my question,
How can I know which button does the user click ??
"Microsoft" <me@me.com> ¦b¶l¥ó news:eE**************@TK2MSFTNGP10.phx.gbl ¤¤
¼¶¼g... Note a handler can handle more than one event, you can determine the sender's name within the handler. The example here handler all three
boxes. Alternatively you can have a handler for each Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
End Sub "Agnes" <ag***@dynamictech.com.hk> wrote in message news:u$**************@TK2MSFTNGP12.phx.gbl... I create an array to store the radiobutton list. If the user click the 3rd buttons, I should store the value 2 into the table fields, My method is check each radio button whether is checked or not, if Me.rb1stbutton.checked than .. store 0 if Me.rb2..... checked then store 1 ........ if Me.rb6... checked then store 5.
Any other simple method to know which button is checked ? thanks a lot
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles RadioButton1.CheckedChanged,
RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
Dim rb As RadioButton
rb = DirectCast(sender, RadioButton)
Select Case rb.Name
Case Me.RadioButton1.Name
'Ur Action
Case Me.RadioButton2.Name
'Ur Action
Case Me.RadioButton3.Name
'Ur Action
End Select
End Sub
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl... I know handler can handler many event. but my question, How can I know which button does the user click ??
"Microsoft" <me@me.com> ¦b¶l¥ó news:eE**************@TK2MSFTNGP10.phx.gbl
¤¤ ¼¶¼g... Note a handler can handle more than one event, you can determine the sender's name within the handler. The example here handler all three boxes. Alternatively you can have a handler for each Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
End Sub "Agnes" <ag***@dynamictech.com.hk> wrote in message news:u$**************@TK2MSFTNGP12.phx.gbl... I create an array to store the radiobutton list. If the user click
the 3rd buttons, I should store the value 2 into the table fields, My method is check each radio button whether is checked or not, if Me.rb1stbutton.checked than .. store 0 if Me.rb2..... checked then store 1 ........ if Me.rb6... checked then store 5.
Any other simple method to know which button is checked ? thanks a lot
On Fri, 29 Oct 2004 12:27:39 +0100, Microsoft wrote: Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
Dim rb As RadioButton
rb = DirectCast(sender, RadioButton)
Select Case rb.Name
Rather than use a Select Case, store the associated value in the
RadioButton's Tag property Then you can use a single line in your
CheckChanged Handler:
Private Sub RadioButton_CheckedChanged(...) Handles rb1.CheckChanged,..,...
Dim x As Integer = CInt(DirectCast(sender,RadioButton).Tag)
End Sub
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Thats an interesting and quite clever solution to her problem Chris.
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in
message news:gb******************************@40tude.net.. . On Fri, 29 Oct 2004 12:27:39 +0100, Microsoft wrote:
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
Dim rb As RadioButton
rb = DirectCast(sender, RadioButton)
Select Case rb.Name
Rather than use a Select Case, store the associated value in the RadioButton's Tag property Then you can use a single line in your CheckChanged Handler:
Private Sub RadioButton_CheckedChanged(...) Handles rb1.CheckChanged,..,... Dim x As Integer = CInt(DirectCast(sender,RadioButton).Tag) End Sub
-- Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and replace certain words in my E-Mail address.
Actually, a little variation here to avert the problems of a double fire.
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles RadioButton1.CheckedChanged,
RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
Static lastChanged As Int32
Dim rb As RadioButton = DirectCast(sender, RadioButton)
Dim tag As Int32 = CType(rb.Tag, Int32)
If lastChanged <> tag Then
Debug.WriteLine(tag.ToString)
End If
lastChanged = tag
End Sub
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:uC**************@TK2MSFTNGP11.phx.gbl... Thats an interesting and quite clever solution to her problem Chris.
-- OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray() For i As Int32 = 0 To ch.Length - 1 ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1) Next Process.Start("mailto:" & New String(ch)) --
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in message news:gb******************************@40tude.net.. . On Fri, 29 Oct 2004 12:27:39 +0100, Microsoft wrote:
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
Dim rb As RadioButton
rb = DirectCast(sender, RadioButton)
Select Case rb.Name
Rather than use a Select Case, store the associated value in the RadioButton's Tag property Then you can use a single line in your CheckChanged Handler:
Private Sub RadioButton_CheckedChanged(...) Handles rb1.CheckChanged,..,... Dim x As Integer = CInt(DirectCast(sender,RadioButton).Tag) End Sub
-- Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and replace certain words in my E-Mail address.
OH, Thanks for all your kind help
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> ¦b¶l¥ó
news:Ob**************@TK2MSFTNGP15.phx.gbl ¤¤¼¶¼g... Actually, a little variation here to avert the problems of a double fire.
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
Static lastChanged As Int32
Dim rb As RadioButton = DirectCast(sender, RadioButton)
Dim tag As Int32 = CType(rb.Tag, Int32)
If lastChanged <> tag Then
Debug.WriteLine(tag.ToString)
End If
lastChanged = tag
End Sub
-- OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray() For i As Int32 = 0 To ch.Length - 1 ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1) Next Process.Start("mailto:" & New String(ch)) --
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message news:uC**************@TK2MSFTNGP11.phx.gbl... Thats an interesting and quite clever solution to her problem Chris.
-- OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray() For i As Int32 = 0 To ch.Length - 1 ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1) Next Process.Start("mailto:" & New String(ch)) --
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in message news:gb******************************@40tude.net.. . On Fri, 29 Oct 2004 12:27:39 +0100, Microsoft wrote:
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
Dim rb As RadioButton
rb = DirectCast(sender, RadioButton)
Select Case rb.Name
Rather than use a Select Case, store the associated value in the RadioButton's Tag property Then you can use a single line in your CheckChanged Handler:
Private Sub RadioButton_CheckedChanged(...) Handles rb1.CheckChanged,..,... Dim x As Integer = CInt(DirectCast(sender,RadioButton).Tag) End Sub
-- Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and replace certain words in my E-Mail address.
On Fri, 29 Oct 2004 15:42:03 +0100, One Handed Man ( OHM - Terry Burns )
wrote: Actually, a little variation here to avert the problems of a double fire.
Perhaps a little simpler is to just check the checked property. Since
radiobutton's are mutually exclusive within the same group, only one will
be checked so you could do this to avoid a multiple fire:
Private Sub RadioButton_CheckedChanged(...) Handles rb1.CheckChanged,..,...
If DirectCast(sender,RadioButton).Checked Then
Dim x As Integer = CInt(DirectCast(sender,RadioButton).Tag)
End If
End Sub
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address. This discussion thread is closed Replies have been disabled for this discussion. Similar topics
reply
views
Thread by PawelR |
last post: by
|
1 post
views
Thread by jez123456 |
last post: by
|
4 posts
views
Thread by Ricky W. Hunt |
last post: by
|
8 posts
views
Thread by johnmmcparland |
last post: by
|
2 posts
views
Thread by Rich |
last post: by
|
reply
views
Thread by Rich |
last post: by
|
2 posts
views
Thread by Rich |
last post: by
|
2 posts
views
Thread by =?Utf-8?B?UmljaA==?= |
last post: by
|
4 posts
views
Thread by Gugale at Lincoln |
last post: by
| | | | | | | | | | |