Solved

How do I make forms connect using radio buttons and a continue button

Posted on 2006-07-02
11
160 Views
Last Modified: 2010-04-30
I have four forms in VB 6.  I have radio buttons on each and a continue button as well.  I am looking to know how to make each radio button on the form go to one of the other three forms.  I guess this may be a coding question.  Thank you in advance for your assistance.
0
Comment
Question by:lpetrowicz
  • 6
  • 5
11 Comments
 
LVL 18

Expert Comment

by:Crash2100
ID: 17028272
What do you mean, make it "go to one of the other three forms".  Do you want the other form to be able to know what you selected?  Or make it decide which form to show next, depending on what you selected?
0
 

Author Comment

by:lpetrowicz
ID: 17028597
yes, which form to go to next from what I selected
0
 
LVL 18

Accepted Solution

by:
Crash2100 earned 500 total points
ID: 17028631
Do you want them to select something, then click the continue button to proceed?  If so, then you should do something like this:

First create a Frame object to put your radio buttons in (this will make it so only one of the radio buttons can be selected at a time).  Then draw your radio buttons INSIDE of the frame.

Now just put some code similar to this to tell it what to do depending on which option is selected:

Private Sub Command1_Click()
    Me.Hide  'hides the current form

    If Option1.Value = True Then Form1.Show
    If Option2.Value = True Then Form2.Show
    If Option3.Value = True Then Form3.Show
End Sub
0
 

Author Comment

by:lpetrowicz
ID: 17028650
Thank you so much!  Very helpful information.    
0
 
LVL 18

Expert Comment

by:Crash2100
ID: 17028664
I'm glad I could help!  If you need any help implementing this into your program, feel free to post a comment and I'll try and walk you though it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:lpetrowicz
ID: 17028667
Thanks again.
0
 

Author Comment

by:lpetrowicz
ID: 17031037
I am so new to this I must ask.  Where you have "Command1" in the code, is that what it should say or should it read what I actually have on the button?  The same question with Option1 and Form1.  Thank you again for any assistance.
0
 
LVL 18

Expert Comment

by:Crash2100
ID: 17031211
It doesn't have to say that, just assume you insert whatever you name the button you create, wherever I put "Command1".  Usually you give it a name that has something to do with it's function, since you want it to be called "continue", it would likely be named "cmdContinue" (the cmd is because it's a command button).

You can do the same thing with the option buttons and the forms.  Option button names usually begin with "opt" and form names with "frm".
0
 

Author Comment

by:lpetrowicz
ID: 17031395
Thank you so very much!!  Extrememly helpful!
0
 

Author Comment

by:lpetrowicz
ID: 17031478
Let me make sure I have this then, please.  I have three forms named Form1, Form2 and Form3.  On Form1 I have two radio buttons that are labeled A and B.  I also have a command button named Next.  I want to be able to select either radio button and hit Next to go to one or the other.  Is this the proper code below?

Private Sub cmdNext_Click()
    Me.Hide "hides the current form

    If optA.Value = True Then Form2.Show
    If optB.Value = True Then Form3.Show
End Sub
0
 
LVL 18

Expert Comment

by:Crash2100
ID: 17033115
It looks good to me, have you tried it yet?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now