-
March 22nd, 2010, 05:23 AM
#1
[RESOLVED] Open a 2nd form from menu and when closing it placeing the contents in a combo box
Hi, can a user open a second form from the menu? I know how to use the menu editor to open files, and add commands but i don't know how ( and couldn't find) the code for opening a second form, is this possible?
If it is can i then send some contents from a textbox(from form 2) to a combo box that is located in form 1?
thanks in advance for taking the time to read and maybe answer my question
-
March 22nd, 2010, 08:11 AM
#2
Re: Open a 2nd form from menu and when closing it placeing the contents in a combo bo
Yes it is... One way...
But this will do nothing for you on retrieving values from Form2 and this code will allow the user to interact with both forms at the same time so more than likely you will want to show form2 with the vbmodal constant...
Code:
Form2.Show vbModal, Me
This will allow the user only to be able to interact with form2 until it is closed/or hidden. So, instead of putting a unload me in the click event of the command button that will make form2 go away, use me.hide and then in form1 you will be able to pull the value from the text box with something like...
Code:
MyVariable = Form2.Text1.Text
Combo1.AddItem MyVariable
After that, you can put the unload form2 code in... So, your entire code in form1 would look like...
Code:
Form2.Show vbModal, Me
MyVariable = Form2.Text1.Text
Combo1.AddItem MyVariable
Unload Form2
Now, that is only one way in which to achieve what you want...
Good Luck
-
March 22nd, 2010, 09:44 AM
#3
Re: Open a 2nd form from menu and when closing it placeing the contents in a combo bo
Right. And in fact you don't even have to use a variable inbetween since you can directly add to the combo box:
Code:
Combo1.AddItem Form2.Text1.Text
Combo1.AddItem Form2.Text2.Text
...
-
March 22nd, 2010, 12:54 PM
#4
Re: Open a 2nd form from menu and when closing it placeing the contents in a combo bo
thanks a lot for the answers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|