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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box control 1

Status
Not open for further replies.

Elena

Technical User
Oct 20, 2000
112
US
OK, I know this should be simple, but I can't figure it out. I have a drop-down combo box with a list of systems and I have a list box control that I want to automatically fill in with the BIOS rev from the system that is selected in the combo box. I put this in the change event of the combo box:

Private Sub millssys_Change()
If millssys.Text = "Dell Optiplex GX1, PIII 450, 128M RAM" Then
millsbios.Text = "Phoenix BIOS Rev. A06"
End If
If millssys.Text = "Compaq Deskpro EN, PIII 700. 128M RAM" Then
millsbios.Text = "Compaq BIOS ver 686T3"
End If
If millssys.Text = "Toshiba Equium 7350D 667Mhz PIII" Then
millsbios.Text = "AMIBIOS version 1.18"
End If
End Sub

I also tried using the ListIndex Property, but that isn't working either.

What am I doing wrong?

Any help for this newbie would be appreciated.

Thanks,

Elena
 
Sorry that list box should be text box.
 
My recommended solution is to have two tables;

vtblBIOS
Primary Key = BiosID 1
Vendor AMIBIOS
Version 1.18

vtblComputer
Primary Key = ComputerID
Vendor Toshiba
Model Equium
MegaHertz 667
Processor PIII
BiosID 1

Then, in the table where you are defining your current resources you could select the computer and it would know what the BIOS was. The combobox RowSource property could have "SELECT Vendor, Model, MegaHertz, Processor FROM vtblComputers;'

Note: This would not be a fully normalized solution but it currently is not or millsssys.Text would not have 4 different pieces of information.

Try this for simplification:

Select Case millssys.Text
Case "Dell Optiplex GX1, PIII 450, 128M RAM"
millsbios.Text = "Phoenix BIOX Rev. A06"
Case ...
' Case ... text
Case Else
' Else text
End Select

Steve King
 
Steve,

You lost me on the table thing. Would these be external tables?


I don't understand why the change event procedure isn't working in the first place. If I do the second procedure you suggested, wouldn't it be the same thing, in effect? I mean If...then and case can be used interchangeably, right? What's the difference?

I'm sorry if I seem dumb, it's because I am. At least about VB. Still alot to learn.

Thanks for the help.

Elena
 
Hi,

If I understand you correctly you have a combo box filled with systems and a text box that you want to display the corresponding BIOS rev? I am assuming that these controls are not bound to a database. If this is correct then insert the following code into your combobox CLICK event. Modify as needbe.

Private Sub cboSystem_Click()
Select Case cboSystem.ListIndex
Case 0
txtBios.Text = "sy1: BIOS"
Case 1
txtBios.Text = "sy2: BIOS"
Case 2
txtBios.Text = "sy3: BIOS"
Case Else
txtBios.Text = ""
End Select
End Sub
 
Thanks. That was most helpful. All I needed was to change from the Change() event to the Click() event. That did it!

Elena
 
Move your code from 'change' event to 'click' event of combobox, and use combobox1.listindex in if condition, instead of string..!!:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top