View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default pass value from combobox on form1 to a label.caption

Hi all,

I want to pass the value that is chosen in a combobox (serving as a
lookup) to a second form and put it in a label caption.

I have publicly declared (public order as string) the chosen value,
but when i activate the second form the variable seems to change to
'nothing'.

Anybody got any ideas how to solve this?

Thanks in advance.

Sybolt


You need to make your public variable 'global' in scope so it can be
accessed anywhere in your project. I use a standard module named
'm_OpenClose' where I put all startup/shutdown code and declare/define
all global variables/constants/declares.

In this startup module...

Public gsOrder As String

...and in your 1st form...

gsOrder = ComboBox1.Text

...so it's available thereafter to your 2nd form.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion