What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » VB.NET radio buttons help

VB.NET radio buttons help
Author: Message:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. Huh?  VB.NET radio buttons help
I'm trying to make a little program with 2 groups of radio buttons.

With HTML I would give the 2 groups the same name and a different variable, but how does it work in VB.NET?

I checked the MSDN but couldn't find anything.

What I want is 3 radio buttons to choose a size, and 2 to choose black & white or color.

TIA
[Image: 1-0.png]
             
11-04-2005 08:06 PM
Profile PM Web Find Quote Report
Kryptonate
Veteran Member
*****

Avatar

Posts: 2874
Reputation: 23
38 / Male / –
Joined: Jun 2003
RE: VB.NET radio buttons help
You can work with 2 seperate functions. The first one includes the 3 radiobuttons for the size and the other one includes the radiobuttons for the color. Use the If-structure to see what is checked so the program can change the outcome.
11-04-2005 08:42 PM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: VB.NET radio buttons help
How do you mean?

I tried it like this, but it doesn't work

code:
Function grootte()
        If (RadioButton1.Checked = True) Then
            MsgBox("button1")
        ElseIf (RadioButton2.Checked = True) Then
            MsgBox("button2")
        ElseIf (RadioButton3.Checked = True) Then
            MsgBox("button3")
        End If
    End Function

    Function kleur()
        If (RadioButton4.Checked = True) Then
            MsgBox("button4")
        ElseIf (RadioButton5.Checked = True) Then
            MsgBox("button5")
        End If
    End Function
[Image: 1-0.png]
             
11-04-2005 09:15 PM
Profile PM Web Find Quote Report
Kryptonate
Veteran Member
*****

Avatar

Posts: 2874
Reputation: 23
38 / Male / –
Joined: Jun 2003
RE: VB.NET radio buttons help
This works:
code:
Private Function grootte()
        If RadioButton1.Checked = True Then
            MessageBox.Show("button1")
        ElseIf RadioButton2.Checked = True Then
            MessageBox.Show("button2")
        ElseIf RadioButton3.Checked = True Then
            MessageBox.Show("button3")
        End If
    End Function

Private Function kleur()
        If RadioButton4.Checked = True Then
            MsgBox("button4")
        ElseIf RadioButton5.Checked = True Then
            MsgBox("button5")
        End If
    End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        grootte()
        kleur()
    End Sub

11-04-2005 09:31 PM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: VB.NET radio buttons help
Doesn't work for me.

If I click radiobutton2 and after that 5 for example it enables 5, not 2 anymore
[Image: 1-0.png]
             
11-04-2005 09:36 PM
Profile PM Web Find Quote Report
Kryptonate
Veteran Member
*****

Avatar

Posts: 2874
Reputation: 23
38 / Male / –
Joined: Jun 2003
RE: VB.NET radio buttons help
If you check 2 and then 5 and then press the button it shows 2 messageboxes. So it works, no?
11-04-2005 09:40 PM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: VB.NET radio buttons help
No, it only shows one messagebox, the button5 one
[Image: 1-0.png]
             
11-04-2005 09:43 PM
Profile PM Web Find Quote Report
Kryptonate
Veteran Member
*****

Avatar

Posts: 2874
Reputation: 23
38 / Male / –
Joined: Jun 2003
RE: VB.NET radio buttons help
Place the radiobuttons in 2 groupboxes. The first three in the first one and the other two in the other one. This is how I did it and it works.
11-04-2005 09:51 PM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: VB.NET radio buttons help
that's the way I have it too.

Btw, I added you on MSN, kryptonate@gmail.com

EDIT: Got it working YAY!

Thanks very Much Kryptonate (Y)

This post was edited on 11-04-2005 at 10:01 PM by Ezra.
[Image: 1-0.png]
             
11-04-2005 09:56 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On