-
Dec 9th, 2017, 11:06 AM
#1
Thread Starter
Member
I wanna make two programs in one.
Hi guys
I made to programs and I wanna put them into one program, something like I open a program and gives me two choices a.k.a buttons, If I choose button one, it opens program one, and If I choose button two, it opens program two.
I don't wanna make connection like load file from C\: ..., I want to make it like database in the program.
Hope you understood my ****** English!
-
Dec 9th, 2017, 11:46 AM
#2
Re: I wanna make two programs in one.
Do you actually want two programs?
In most cases having two windows (aka Forms) is the way to go, and sometimes even merge them onto one window.
-
Dec 9th, 2017, 01:00 PM
#3
Re: I wanna make two programs in one.
Windows applications start up by showing a form.
So you need to combine the code from both projects into one project, but make the startup form one with two buttons on it. Each button shows the right form for the selected program.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Dec 9th, 2017, 01:12 PM
#4
Thread Starter
Member
Re: I wanna make two programs in one.
Originally Posted by Sitten Spynne
Windows applications start up by showing a form.
So you need to combine the code from both projects into one project, but make the startup form one with two buttons on it. Each button shows the right form for the selected program.
Yeah
-
Dec 9th, 2017, 08:34 PM
#5
Junior Member
Re: I wanna make two programs in one.
Sounds like you should create three forms. The first form would have the two buttons and then the other forms would be what is displayed when you click either of the buttons. Is this what you are trying to accomplish?
If this is the case, my example is I have a button "Go to Form 2". When clicked it will take you to that form. And lets say form 2's name property is form2. Then you would use this:
form2.Show()
This will show form 2 when you click that particular button.
Last edited by VBAppleCoder; Dec 9th, 2017 at 08:44 PM.
-
Dec 10th, 2017, 06:18 AM
#6
Thread Starter
Member
Re: I wanna make two programs in one.
Originally Posted by VBAppleCoder
Sounds like you should create three forms. The first form would have the two buttons and then the other forms would be what is displayed when you click either of the buttons. Is this what you are trying to accomplish?
If this is the case, my example is I have a button "Go to Form 2". When clicked it will take you to that form. And lets say form 2's name property is form2. Then you would use this:
form2.Show()
This will show form 2 when you click that particular button.
If I export the project as exe, I am talking about the form that opens the two programs, does it require the other files to use them? for example I wanna copy them into CD, can I open both programs from the form without having them?
-
Dec 10th, 2017, 06:56 AM
#7
Re: I wanna make two programs in one.
If you create them as separate programs, you will need to distribute all of the programs in some way.
If you add the code for them all to the same project (which is what all of us have described) then you will have just one exe file, which contains all the "programs".
The example VBAppleCoder (and Sitten) described is that you have two separate projects at the moment, but merge them into one project (you can add existing forms to a project, or copy+paste, etc). Then create a new form which just has buttons to show the other forms, and is set as the start object for the project.
-
Dec 10th, 2017, 08:41 AM
#8
Re: I wanna make two programs in one.
Originally Posted by casper.mta
If I export the project as exe, I am talking about the form that opens the two programs, does it require the other files to use them? for example I wanna copy them into CD, can I open both programs from the form without having them?
Casper, in your first post you asked for all your programs to be included into one. Everyone above informed you how to do this, but you either don't understand what they wrote, or you're not sure what you want.
Within the project of the program that will launch the other two programs, click "Project" on top left, and within it's dropdown menu click "Add Windows Form". You will have to do this twice. After doing this you will have form2 & form3 where you would add the code for your other two programs.
Make sure those forms (form2 & form3) are hidden.
Also, in Form2_load and Form3_load add:
Code:
Me.ShowInTaskbar = False
In Form1's buttons, from the same project you added your code, add for Button1_Click:
Code:
Form2.Show()
Form2.ShowInTaskbar = True
for Button1_Click:
Code:
Form3.Show()
Form3.ShowInTaskbar = True
This will launch and show the programs you combined with the project that starts them.
In the end, all your programs have been placed into one, just what you wanted. There are no other programs to copy to the CD, because again, your programs have all been placed into one by extra forms.
Last edited by Peter Porter; Dec 10th, 2017 at 09:08 AM.
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
|