473,974 Members | 29,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Radio Button Choice Displaying in a MessageBox

5 New Member
Hello, I have a group box (grpButtons) with four radio buttons (radAbortRetryI gnore, radOK, radOKCancel, radYesNo) what I am trying to do is display the buttons in the messagebox based on the selection the user makes with the radio buttons.

MessageBox.Show (txtTitle.Text, txtMessage.Text , grpButtons())

where I have grpButtons() is where Im having the problem, Im trying to have the message box display what the user chooses. Can this be done with an array???? I have tried several different ways and keep getting errors. Any help would be appreciated.

Thank You in Advance. I am enclosing what I have done so far, If I could get a push in the right direction as to how to tie in the radio button selected to the message box i will be able to figure out the rest

P.S. How do I upload the project if need be????
May 15 '07 #1
2 10977
Sarge
5 New Member
Sorry, I am using VB.Net version 2003
May 15 '07 #2
shidec
26 New Member
if u want use array u can write like this

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Private radChoice(4) As RadioButton
  4.     Private selectedIndex As Integer
  5.  
  6.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.         radChoice(0) = radChoice0
  8.         radChoice(1) = radChoice1
  9.         radChoice(2) = radChoice2
  10.         radChoice(3) = radChoice3
  11.     End Sub
  12.  
  13.     Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
  14.         MessageBox.Show(radChoice(selectedIndex).Text)
  15.     End Sub
  16.  
  17.     Private Sub radChoice0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radChoice0.Click, radChoice3.Click, radChoice2.Click, radChoice1.Click
  18.         Dim rb As RadioButton
  19.         rb = CType(sender, RadioButton) 'use sender argument to determine wich radio button clicked
  20.         selectedIndex = rb.Tag   'every tag property of radio button must set first
  21.         MessageBox.Show(rb.Text) 'just try to show message when radio button click
  22.     End Sub
  23.  
  24. End Class
  25.  

if u just want to show message according to radio button selected
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Private sMessage as String
  4.     Private selectedIndex As Integer
  5.  
  6.     Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
  7.         MessageBox.Show(sMessage)
  8.     End Sub
  9.  
  10.     Private Sub radChoice0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radChoice0.Click, radChoice3.Click, radChoice2.Click, radChoice1.Click
  11.         Dim rb As RadioButton
  12.         rb = CType(sender, RadioButton) 'use sender argument to determine wich radio button clicked
  13.         sMessage = rb.Text
  14.         MessageBox.Show(rb.Text) 'just try to show message when radio button click
  15.     End Sub
  16.  
  17. End Class
  18.  
  19.  

Note:
There is only one radio button click event to handle all of radio button.
So every radio button must refer to this event
May 16 '07 #3

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

Similar topics

2
7551
by: Renie83 | last post by:
Hi all! I was wondering does anyone have any ideas on how I can send info to a SQL database by choosing a radio button. What I want to do is set one radio button to "Max" and one to type "Avg". When a user clicks on a radio button I want the value of whatever button was chosen to be placed inside the "type" field in my database after they hit submit. Also, if anyone knows of the best sites or books I can use about VBScript or ASP please...
1
1608
by: Matt | last post by:
The following code is try to validate if the user selects a radio button choice. I dont understand why document.UserInputs.question.value; gets undefined value even user make a choice. I tried text box and drop down list, and it works fine. <html> <head> <script type="text/javascript"> function CheckForm()
2
2902
by: Stoic | last post by:
I'm offering a selection of three items. One is $25, the second is $50, the third is $100. Along with selection one of the items I need to pass the quantity of the selection. Here is the code now. <tr><td><input type="radio" name="item_name" value="Reduced">Reduced</td><td><input type="radio" name="amount" value="25">$25.00ea.</td></tr> <tr><td><input type="radio" name="item_name" value="Regular">Regular</td><td><input type="radio"...
3
3150
by: John Davis | last post by:
I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons. When the user click the first radio button, the text will change to uppercase. If the user clicks the other radio button, the text will change to lowercase. I added the following event, but still won't able to change the text to uppercase. Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
0
1819
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 conversion). When the user enters a text in >text field, the user can click the radio button for case conversion. I set >the property of radio button to AutoPostBack=True, the
8
6777
by: romano2717 | last post by:
I used the for loop variable $i to each radio button so that each radio button will have a unique name. the problem now is how can i display the values selected in the radio button on the same page as where the form is located. your help is greatly appreciated.. thanks here's the code: NOTE: this code is cut short, i only posted the part where i got stuck <?php if(isset($_GET)){ $num = $_GET; $num = 2; for($i=1; $i<=$num; $i++...
9
9924
by: ameshkin | last post by:
Hi guys, I'm a pretty good PHP programmer, but when it comes to JS, I just dont understand it! But I really need to learn. I'm having trouble doing the simplest thing! When someone clicks on this image, I want the radiobutton above it to be checked. Not that hard,but nothing I try seems to work. Can someone please help me?
2
6018
by: makunta | last post by:
Hi all, First here is the website of what I am trying to do: http://www.exmhosting.com/ Locate the login form on the top-right of the page. What I need to do is allow the user to sign into different sections of the website according to the radio button choice at login. If the user chooses Webmail then they input their email address and password and login. If the user chooses clients they input their username and password and login. ...
4
2059
by: makunta | last post by:
Hi all, First here is the website of what I am trying to do: http://www.exmhosting.com/ Locate the login form on the top-right of the page. What I need to do is allow the user to sign into different sections of the website according to the radio button choice at login. If the user chooses Webmail then they input their email address and password and login. If the user chooses clients they input their username and password and login. ...
0
10347
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10160
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11399
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10901
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
5148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4726
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.