473,402 Members | 2,061 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,402 software developers and data experts.

Radio Button Choice Displaying in a MessageBox

5
Hello, I have a group box (grpButtons) with four radio buttons (radAbortRetryIgnore, 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 10817
Sarge
5
Sorry, I am using VB.Net version 2003
May 15 '07 #2
shidec
26
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
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"....
1
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...
2
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....
3
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,...
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...
8
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...
9
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...
2
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...
4
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.