ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pass value from combobox on form1 to a label.caption (https://www.excelbanter.com/excel-programming/450982-pass-value-combobox-form1-label-caption.html)

Roady Mayhem

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

GS[_6_]

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




All times are GMT +1. The time now is 06:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com