Working with RadioButtons in VB.NET

I have a form with two radio buttons ( ADD and DELETE ) in a group ( SELECTION). When the use selects any button, the value should be displayed in a messageBoX alon with the name of the button(ADD or delete in this case) and sore that value in a new string.Can you please help me?
g46905Asked:
Who is Participating?
 
TorrwinConnect With a Mentor Commented:
For Each item In Me.GroupBox1.Controls
            If DirectCast(item, RadioButton).Checked Then
                MsgBox(item.Text & " is checked!")
            End If
Next item
0
 
TorrwinCommented:
Is this a homework assignment?  We're here to assist, not write the program for you. =)
0
 
g46905Author Commented:
I am new to VB.NET technology and having issues while using controls

Thanks,
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
TorrwinCommented:
Ok, so what do you have written so far?  Where are you stuck?  If you post what you have written we'll be able to help you better.
0
 
g46905Author Commented:
I have marked the arrow where I am stuck.As I am new to this technology, I am sure the task might sound simple or silly.
But I guess we all have to start somewhere.Thanks for your patience and cooperation.


Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
        'call user set
        Dim usr As User = New User
        If (Me.cmbRole.SelectedIndex > -1) Then
        usr.USER_TYPE = Me.cmbRole.SelectedItem
        End If
        Dim item As Control

        For Each item In Me.GroupBox1.Controls
            If DirectCast(item, RadioButton).Checked Then
                MsgBox("Radio button is checked!") <----------------------it should diplay the name of the radio button selected
            End If
        Next item

        usr.WP_USER_ID = 6 'Me.tbUserId
        usr.TNUMBER = Me.tbUserId.Text.Trim
        User.SetUser(usr)

Thanks again
0
 
g46905Author Commented:
I really appreciate you for the immediate response.Thanks for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.