Coding radio buttons in VB.NET

Trouble with coding radio buttons

Page 1 of 1

3 Replies - 17466 Views - Last Post: 25 February 2009 - 06:13 PM Rate Topic: -----

#1 Country Chic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 11-February 09

Coding radio buttons in VB.NET

Post icon  Posted 25 February 2009 - 05:45 PM

I'm having issues with my current homework. I've got 6 different radio buttons and depending on which one is checked, the corresponding price shows up in the text box.
I'm not sure if I need to create a sub-procedure or what. I can't seem to get anything to work. Any help would greatly be appreciated, Thanks.

Select Case medProcedures
	  Case "Fecal check"
			   me.uiFeeLabel.Text = "5"
	  Case "Heartworm test"
			   me.uiFeeLabel.Text = "15"
	  Case "Office visit"
			  me.uiFeeLabel.Text = "15"
	  Case "Other shots"
			  me.uiFeeLabel.Text = "5"
	  Case "Rabies vaccination"
			  me.uiFeeLabel.Text = "15"
	   Case "Teeth cleaning"
			  me.uiFeeLabel.Text = "50"
End Select


I've gotten this far with the code but not sure where to go next.

Is This A Good Question/Topic? 0
  • +

Replies To: Coding radio buttons in VB.NET

#2 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: Coding radio buttons in VB.NET

Posted 25 February 2009 - 05:52 PM

You need to code the RadioButton controls.

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

TextBox1.Text = "RadioButton1 Selected"

End Sub 



I hope this is a good push in the right direction! If you have any other questions feel free to let me know!
Was This Post Helpful? 0
  • +
  • -

#3 Country Chic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 11-February 09

Re: Coding radio buttons in VB.NET

Posted 25 February 2009 - 06:04 PM

Do I do that for each radio button seperately? How do I get the corresponding prices to show up in the one text box? Would I use that Select Case statement?


View Postpr4y, on 25 Feb, 2009 - 04:52 PM, said:

You need to code the RadioButton controls.

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

TextBox1.Text = "RadioButton1 Selected"

End Sub 



I hope this is a good push in the right direction! If you have any other questions feel free to let me know!

Was This Post Helpful? 0
  • +
  • -

#4 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: Coding radio buttons in VB.NET

Posted 25 February 2009 - 06:13 PM

        If RadioButton1.Checked Then
            ' do something
        ElseIf RadioButton2.checked Then
            ' do something
        End If



I hope this clears things up!

Let me know if you have any other questions, as I would be happy to be of assistance!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1