i need to have 14 string items in a combobox
each item needs to have a different value but the same variable, how would i do this.
im new to programming.
help would be apreciated much. thanks!!!!!
i need to have 14 string items in a combobox
each item needs to have a different value but the same variable, how would i do this.
im new to programming.
help would be apreciated much. thanks!!!!!
Hi,
Not Clear.. What does Same Variable mean..?
Do you want to get Selected Item of the ComboBox in Some Variable..?
MyVar = Combo1.Text
Regards
Veena
ok,
ive got a combobox. ill tell you some choices that are in it. :
vacant lot
seaside lot
casino
shopping mall
when you click one of these, they are connected to the same variable. because im figuring one problem at a time, the choice which you choose is now connected to a variable, this variable is put into an equation and figured. each choice will have two things attached to it.
its monetary value, and itself, like its own name.
but im not exactly sure if it can be done.
also, each option must be able to show itself in an output, as a string
ok,
ive got a combobox. ill tell you some choices that are in it. :vacant lot
seaside lot
casino
shopping mallwhen you click one of these, they are connected to the same variable. because im figuring one problem at a time, the choice which you choose is now connected to a variable, this variable is put into an equation and figured. each choice will have two things attached to it.
its monetary value, and itself, like its own name.but im not exactly sure if it can be done.
also, each option must be able to show itself in an output, as a string
personally, i'd create a type, could be public or private, going to go public for now...
public type lotStyle
stLot as string
cPrice as currency
end type
Public LotStuff() as lotStyle
then you can set your values, or load them from a file
public sub SetValues_hardCoded()
redim LotStuff(1 to 4)
LotStuff(1).stLot = "vacant lot"
LotStuff(1).cPrice = 5000
LotStuff(2).stLot = "seaside lot
LotStuff(2).cPrice = 10000
LotStuff(3).stLot = "casino
LotStuff(3).cPrice = 100000
LotStuff(4).stLot = "shopping mall
LotStuff(4).cPrice = 150000
end sub
- or -
public sub SetValues_fromFile(stFileName as string)
open stFileName for random as #1 len=len(LotStuff)
dim x as integer
for x = 1 to lof(1) / len(LotStuff)
ReDim preserve LotStuff(1 to x)
get #1, x, LotStuff(x)
next x
end sub
- then -
Private Sub Form1_Load()
'this assumes that the variable information has already been loaded...
dim X as Integer
For X = LBound(LotStuff) to UBound(LotStuff)
cboComboBox.addItem LotStuff.stLot
Next X
End Sub
hope that helps :)
thank you VERY much. if you can, add me. please.
that helps out sooo much. when i get home from school im gunna try it.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.