Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[WN] Getting a Value from a Combo box


Guest
 Share

Recommended Posts

I'm not quite sure what the command or syntax is for getting a value from a Combo Box (e.g.  CmbClass) is, for example, if someone chose their class to be a warrior (in the combo box) then the class description would be blablabla. Thanks in advance.
Link to comment
Share on other sites

Not quite sure what you mean. What I'm trying to make is a class description box. Basically it reads off the combo box so if the combo box's option is set to "Warrior" then the description box will read off the classes.ini file and put the description in the box? How would I make it so that if the combo box says something the description box changes to that class' description?
Link to comment
Share on other sites

Still not sure, I tried this for each classes (Dim'd the classes as Long aswell..In sub formload):

If cmbClass.ListIndex = Berserker Then
lblClassDesc.Caption = GetVar(App.Path & "\Data Files\classes.ini", "DESCRIPTIONS", "Berserker")

Did that for every class…nothing.
Link to comment
Share on other sites

Ok I'll try and explain this a bit clearer so you can understand.

When you make a combo box you might add a list of names such as "Warrior, Ranger, Wizard"  In that list example the names are displayed top to bottom according to order, in this case the drop down box would look like

Warrior
Ranger
Wizard

The command cmboClass.ListIndex returns the index number that is selected.  Combo boxes are numbered starting from 0 to the end of their list.  The Above example has 3 items in its list, so the index are numbered as following

0
1
2

or

0 = Warrior
1 = Ranger
2 = Wizard

So the .ListIndex returns a number 0-2.  Sometimes the class.ini file will number the first class as class 0, if thats the case then everything is simple.  If however the classes are numbered from 1 and up then your need to -1 from the comparison.  Example would be

comboClass.ListIndex = (CLASS - 1)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...