radiobutton: how do i use like this!!

Posted on 2004-10-25
Last Modified: 2010-04-23
i have 3 radio buttons on a windows form heres what i want to do:

i need to return 0,1, or 2 as what one is chosen..

i also need to set tips for each radio button via code..

and i need the value to be assigned to Protocols_Authentication {either 0,1,2}

how do i do this in
aka Pern
Question by:Johnny
    LVL 85

    Accepted Solution

    Public Class Form1
        Inherits System.Windows.Forms.Form

    #Region " Windows Form Designer generated code "

        Public Sub New()

            'This call is required by the Windows Form Designer.

            'Add any initialization after the InitializeComponent() call

        End Sub

        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                End If
            End If
        End Sub

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
        Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
        Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.RadioButton1 = New System.Windows.Forms.RadioButton
            Me.RadioButton2 = New System.Windows.Forms.RadioButton
            Me.RadioButton3 = New System.Windows.Forms.RadioButton
            Me.RadioButton1.Location = New System.Drawing.Point(8, 8)
            Me.RadioButton1.Name = "RadioButton1"
            Me.RadioButton1.Size = New System.Drawing.Size(96, 24)
            Me.RadioButton1.TabIndex = 0
            Me.RadioButton1.Text = "RadioButton1"
            Me.RadioButton2.Location = New System.Drawing.Point(8, 32)
            Me.RadioButton2.Name = "RadioButton2"
            Me.RadioButton2.Size = New System.Drawing.Size(96, 24)
            Me.RadioButton2.TabIndex = 1
            Me.RadioButton2.Text = "RadioButton2"
            Me.RadioButton3.Location = New System.Drawing.Point(8, 56)
            Me.RadioButton3.Name = "RadioButton3"
            Me.RadioButton3.Size = New System.Drawing.Size(96, 24)
            Me.RadioButton3.TabIndex = 2
            Me.RadioButton3.Text = "RadioButton3"
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(292, 266)
            Me.Name = "Form1"
            Me.Text = "Form1"

        End Sub

    #End Region

        Private Protocols_Authentication As Integer

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim toolTip1 As New ToolTip

            toolTip1.AutoPopDelay = 5000
            toolTip1.InitialDelay = 1000
            toolTip1.ReshowDelay = 500
            toolTip1.ShowAlways = True

            toolTip1.SetToolTip(Me.RadioButton1, "Option 1")
            toolTip1.SetToolTip(Me.RadioButton2, "Option 2")
            toolTip1.SetToolTip(Me.RadioButton3, "Option 3")
        End Sub

        Private Sub RadioButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
            Handles RadioButton1.Click, RadioButton2.Click, RadioButton3.Click

            If RadioButton1.Checked Then
                Protocols_Authentication = 0
            ElseIf RadioButton2.Checked Then
                Protocols_Authentication = 1
            ElseIf RadioButton3.Checked Then
                Protocols_Authentication = 2
            End If
            MsgBox("Protocols_Authentication = " & Protocols_Authentication)
        End Sub

    End Class

    Author Comment

    wow that was quick..thx exactaly what i wanted...

    hopefully i can use this in other places..


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…

    857 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now