Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

switching forms

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am making a project that has 3 combo list boxes. I am trying to get it to where it will pop up another form when all three equal somthing. It just wont work. Can you help? Thanks
 
what command are you using when you want the form to popup

Form2.Show vbModal, Form1?
something like that?

It's usally helpful if you post code sniplets. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Ok Im kinda new to visual...but so far i have one combo list box....and i want it to do this. When u click it gives list of options (done), when you select one and then click button....it will go to a different form...here is the code i have now that doesn't work too well. RD and SH are forms that I want to load...they stand for RainDance and StoneHenge

Private Sub Command1_Click()
Dim a As Integer
If Combo1.DataMember = StoneHenge Then
a = 1
End If
If a = 1 Then
SH.Show vbModal, Form1
End If
If Combo1.DataMember = RainDance Then
a = 2
End If
If a = 2 Then
notd.Show vbModal, Form1
End If
 
ok, now I take it that code is what appears in OnClick for the button. I also take it that you haveonly one combobox, and you want to open a form depending on whats chosen, I can fix up that code right there alittle but still lost as to what you mean

[tt]
If Combo1.ListIndex <> -1 then
Select Case Combo1.DataMember
Case StoneHendge
SH.Show vbModal, Form1
Case RainDance
notd.Show VbModal, Form1
end select
end if
[/tt]

also I dont even know why yer using that 'a' variable when you could have simply done this:

[tt]
If Combo1.DataMember = StoneHenge Then
SH.Show vbModal, Form1
End If

If Combo1.DataMember = RainDance Then
notd.Show vbModal, Form1
End If
[/tt]

or even this

[tt]
If Combo1.DataMember = StoneHenge Then
SH.Show vbModal, Form1
ElseIf Combo1.DataMember = RainDance Then
notd.Show vbModal, Form1
End If
[/tt]

did that help any? [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
oh also Combo1.ListIndex is the index of the currently selected item, if it's -1 that means no item has been selected. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top