By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,005 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

VB.Net-2005 variable transfer from main form to dialog box, 2-nd (not main) project o

P: 3
VB.Net-2005.
I have two projects in one solution. The problem relates to the second project only.
In the second project I have main form and dialog box.
On main form I have combo box with few selections. I need to read value from that combo box (on main form) to dialog box.
When I set "stop" being in "form load" of dialog box and say: strValue = mainForm.comboBox.SelectedItem the strValue equals to nothing. Why? The focus gets to "form load" event of dialog box, reads statement strValue = ...., jumps to mainForm, returns with "nothing" value.
Note: if I do exactly the same thing being in first (main) project of the solution, everything works fine, i.e. value is delivered, not lost.
Could anyone explain how to get that value of comboBox to dialog box ?
Thank you
Alen Vic.
Jun 29 '15 #1

✓ answered by Seth Schrock

Try setting up a global variable in a module. Set the value of the global variable when the combobox is changed (After Update event). You should then be able to read this variable when your dialog box opens.

Share this Question
Share on Google+
2 Replies


Seth Schrock
Expert 2.5K+
P: 2,932
Try setting up a global variable in a module. Set the value of the global variable when the combobox is changed (After Update event). You should then be able to read this variable when your dialog box opens.
Jun 29 '15 #2

P: 3
Thank you very much Seth.
Jun 30 '15 #3

Post your reply

Sign in to post your reply or Sign up for a free account.