Guest Posted December 5, 2010 Share Posted December 5, 2010 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 More sharing options...
Alatar Posted December 6, 2010 Share Posted December 6, 2010 ListIndex? And then make a validate that change the description using the Index of the item selected. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 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 More sharing options...
Yxxe Posted December 6, 2010 Share Posted December 6, 2010 In your cbo.SelectedIndexChanged grab the text you want from a file or whatever, depending on the ListIndex of the combo box. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 Still not sure, I tried this for each classes (Dim'd the classes as Long aswell..In sub formload):If cmbClass.ListIndex = Berserker ThenlblClassDesc.Caption = GetVar(App.Path & "\Data Files\classes.ini", "DESCRIPTIONS", "Berserker")Did that for every class…nothing. Link to comment Share on other sites More sharing options...
Yxxe Posted December 6, 2010 Share Posted December 6, 2010 The listindex isn't "Berserker". Do it like this:```If cboClass.Listindex = #ClassNum# ThenlblClassDesc.Caption = GetVar...```Where #ClassNum# is the number of the class. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 Ah I see, thanks Lightning. Link to comment Share on other sites More sharing options...
Yxxe Posted December 6, 2010 Share Posted December 6, 2010 No problem. Depending on how classes are indexed (whether they start from 1 or 0) you may need to add a +1 to cboClass.ListIndex if the classes are indexed from 1. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 So then it would beIf cboClass.Listindex + 1= #ClassNum# ThenorIf cboClass.Listindex = #ClassNum# + 1 Then? Link to comment Share on other sites More sharing options...
Yxxe Posted December 6, 2010 Share Posted December 6, 2010 If cboClass.Listindex + 1 = #ClassNum#orIf cboClass.ListIndex = #ClassNum# - 1 Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 Yeah I tried it, didn't work (and btw, its CmbClass) Link to comment Share on other sites More sharing options...
Yxxe Posted December 6, 2010 Share Posted December 6, 2010 Ok… try using '.Text = "Berserker"', or use your breakpoints to determine you index values.. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 Doesn't work either, get a Error 13: Type Mismatch on the line:If cmbClass.text + 1 = "Berserker" Then Link to comment Share on other sites More sharing options...
Yxxe Posted December 6, 2010 Share Posted December 6, 2010 @Sekaru:> Doesn't work either, get a Error 13: Type Mismatch on the line:> > If cmbClass.text + 1 = "Berserker" ThenTry using your brain by removing the "+1". :huh: Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 Hah sorry I'm tired…And it still doesn't work, the caption isn't changing, it isn't showing the descriptions at all. Link to comment Share on other sites More sharing options...
Alatar Posted December 7, 2010 Share Posted December 7, 2010 The ListIndex returns the Index (number) of the item selected (starting from 0). So when that change, you have to change your Label/textbox, etc. using the data stored in your .ini file. Link to comment Share on other sites More sharing options...
Unknown_raven Posted December 8, 2010 Share Posted December 8, 2010 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 likeWarriorRangerWizardThe 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 following012or0 = Warrior1 = Ranger2 = WizardSo 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 becomboClass.ListIndex = (CLASS - 1) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now