Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

vb6 combo box

hi all,

in vb6 is there a way i can find what the original selected index was on the combobox click event?

why i ask?

say we have on form_load 3rd index item selected.

we then select nth item in the combobox.

I need to compared the index of the nth item with that original selected during the click event fired.

I do not want use global or page variables to store the index to get the index.

Thanks in advance for the help

Mustafa
www.hostukdomain.com
[527 byte] By [mhadamji] at [2007-11-11 8:37:37]
# 1 Re: vb6 combo box
I know of no way to determine the previous selected item in a combobox, other than saving it in a form-level variable.
Phil Weber at 2007-11-11 17:25:20 >
# 2 Re: vb6 combo box
i think you can use some code like that as event "onClick" for the combobox , but note that thereis a for example textbox named "dAta" and it's index is "0" and another textbox named "dAtacnt" and it's value is "0" and your combobox is named as "cOmbo" , this method and code is very very basic one for demonstartion only , you can use variables as Mr.Phil said before ...

dAtacnt.text = dAtacnt.text + 1
load dAta (dAtacnt.text)
dAta(dAtacnt.text).text = cOmbo.text

and now to get the values of your 'before' selected items in control "cOmbo" you can use e.g. :-
' This will MsgBox the first selected item in "cOmbo"
MsgBox dAta(1).text

and so on

hope that helped you ,,
AHHB at 2007-11-11 17:26:20 >
# 3 Re: vb6 combo box
thanks guys for the help..

Mustafa
www.hostukdomain.com
mhadamji at 2007-11-11 17:27:21 >
# 4 Re: vb6 combo box
mhadamji,store the current index in the Tag property of the ComboBox,in the click event.Now when you select another item - & before the code which stores the current index in the Tag property is executed in the click event - compare the current index to the previous one as stored in Tag.Simple,isn't?
softraj at 2007-11-11 17:28:15 >
# 5 Re: vb6 combo box
hi softraj..
yes its an elegant way to store current index in the list,combo,radio and checkbox...
i initial stragled but eventual found the tag property.. handy thing..
thanks...

Mustafa
www.hostukdomain.com
mhadamji at 2007-11-11 17:29:24 >