473,322 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Can a radio button have more than 1 function? At the top of my form is a textbox tha

1
Can a radio button have more than 1 function? At the top of my form is a textbox that the user will enter their name. When a radio button is selected, a corresponding picture will show up. I also need a message to show up below at will display a message: It will be [choice of:sunny, snowy, rainy, cloudy - depending on which radio button is selected] weather today, [name entered]. I was thinking that I could do separate text boxes for the [sunny, snowy, cloudy, rainy] and the [name box], but how do I make them transfer their text to the corresponding text boxes?


Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
  3.     End Sub
  4.  
  5.     Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
  6.         If Me.RadioButton1.Checked = True Then
  7.             Me.PictureBox1.Visible = True And
  8.             Me.PictureBox2.Visible = False
  9.             Me.PictureBox3.Visible = False
  10.             Me.PictureBox4.Visible = False
  11.         End If
  12.     End Sub
  13.     Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged
  14.         If Me.RadioButton2.Checked = True Then
  15.             Me.PictureBox2.Visible = True
  16.             Me.PictureBox1.Visible = False
  17.             Me.PictureBox3.Visible = False
  18.             Me.PictureBox4.Visible = False
  19.         End If
  20.     End Sub
  21.  
  22.     Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.CheckedChanged
  23.         If Me.RadioButton3.Checked = True Then
  24.             Me.PictureBox3.Visible = True
  25.             Me.PictureBox1.Visible = False
  26.             Me.PictureBox2.Visible = False
  27.             Me.PictureBox4.Visible = False
  28.         End If
  29.     End Sub
  30.  
  31.     Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.CheckedChanged
  32.         If Me.RadioButton4.Checked = True Then
  33.             Me.PictureBox4.Visible = True
  34.             Me.PictureBox1.Visible = False
  35.             Me.PictureBox2.Visible = False
  36.             Me.PictureBox3.Visible = False
  37.         End If
  38.     End Sub
  39.     Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles ButtonExit.Click
  40.         Close()
  41.     End Sub
  42.     Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles SSRC.TextChanged
  43.     End Sub
  44. End Class
Sep 20 '15 #1
1 1180
Seth Schrock
2,965 Expert 2GB
Remove the "And" at the end of line 7. Also, unless there is other formatting on your textboxes, it would probably be easiest to just have one textbox and change its text.
Expand|Select|Wrap|Line Numbers
  1. Me.Textbox_Name.Text = "Sunny"
Just change the name of the textbox and then put it in the appropriate radio button's code. For the other options, just change the text.
Sep 21 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: NotGiven | last post by:
I have display error ON and error reporting to E_ALL. I have a form that opens fine. When you submit it, all the fields that have nothing in them, for example an un-selected radio button, throw...
6
by: J Mox | last post by:
I have a function that changes which radio button is selected. I need to pass the form name to the function but not the field name and am doing so like: changeRadio(this.form); The function: ...
0
by: vinay | last post by:
why are u not using the radiobutton list??? vinay >-----Original Message----- >I created a simple ASP.NET application with a text field, and 2 radio >buttons (uppercase and lowercase...
24
by: John Gabriel | last post by:
CreateDialogIndirect() fires my Radio button click function without the radio button having being clicked. I am using VC++ 2003.NET. I believe this is yet another Microsoft bug. Have checked dialog...
8
by: helpful sql | last post by:
Hi, I have 2 radio buttons on my Windows form control. The radio button's CheckedChanged event disables or enables other controls on the form based on the value of the Checked property. When the...
9
by: wreed | last post by:
I have a for loop seen below.... var the_form = document.getElementById(formName); for(var i=0; i<the_form.length; i++) { var temp = the_form.elements.type; if (temp == "radio") { for (x =...
1
by: jeddiki | last post by:
Hi, I want to alllow my clients to choose using a radio button selector and then click on the paypal button which sends in the form. This is what I have: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.