473,473 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Open form inside form without closing previous form

8 New Member
as title says.
I cant find a way to do this.
if i use form1.show and click on a button. it opens that form, but as soon as i click again it just reopens it and closes previously opened form.
So is there a way to avoid it?
im using 2 forms, main and secondary, i need to open secondary form as many times as needed (without making tons of new sub forms for that).

Idea is: i have main form with a button. i click on it and it opens new form where ican write note etc, i click again and it opens another one.

and to open those forms in a different place i use loop with time delay.

only problem is opening same form 2+ times.
Sep 27 '07 #1
12 8968
djmauro
8 New Member
oh and i forgot to add that it could also wrk like this:
i have 2 executables, one is main application and other is just a bare "notesheet", just like 2 forms, but:
1)how do i link 2nd .exe with first one, i can use shel lcommand but then i need to recompile every time folder name or path changes or is there a way to link exe if those are in the same folder no matter where that folder is, important is only that these 2 files are in the same directory.
2)id also like to use random location for each opened "notebook" window, but i dont know how to do it when i use shell command.
for form i used:
Form2.Left = RND() *pixels
Form2.Top = RND() *pixels
where pixels are some number for range/area of random location.
Sep 27 '07 #2
djmauro
8 New Member
sry for posting alone but forgot again that im using visual basic 6
Sep 27 '07 #3
djmauro
8 New Member
up noone knows how do do it?
Sep 28 '07 #4
jamesd0142
469 Contributor
Me.Hide
form1.show

is this what you mean?

It hides the exisiting form but does not close it, and opens/shows the 2nd form.

Thanks
Sep 28 '07 #5
Ali Rizwan
925 Contributor
as title says.
I cant find a way to do this.
if i use form1.show and click on a button. it opens that form, but as soon as i click again it just reopens it and closes previously opened form.
So is there a way to avoid it?
im using 2 forms, main and secondary, i need to open secondary form as many times as needed (without making tons of new sub forms for that).

Idea is: i have main form with a button. i click on it and it opens new form where ican write note etc, i click again and it opens another one.

and to open those forms in a different place i use loop with time delay.

only problem is opening same form 2+ times.
Hello
If you wnat to open the main form too as well as the secondary then use this code
Expand|Select|Wrap|Line Numbers
  1. me.enabled=false
  2. form2.show
  3.  
and when you want to close the secondary form on close button put this code
Expand|Select|Wrap|Line Numbers
  1.  
  2. me.hide
  3. form1.enabled=true
  4.  
And if you want to work on both forms then use this
Expand|Select|Wrap|Line Numbers
  1. form2.show
  2.  
GOODLUCK
Sep 28 '07 #6
djmauro
8 New Member
Well almost :)
actually i have two forms, form1 and form2
i would like to open form2 when i click on command button.
thats easy.
BUT if i click again command button, i want it to open form2 again, without closing previously opened form2 window aka id like to open form2 "n" times.
or is there a way to create another window when i click command button?

Actually id like to make simple notebook. when i click button on main form, it opens a window where i can write, if i click again, it opens another one without closing previous window.

and yeah id like to bay back to a friend who made joke on me so i would modify second copy of that program do do something else.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Do
  3. x = Rnd() * 11000
  4. y = Rnd() * 11000
  5. Form2.Left = x * Rnd()
  6. Form2.Top = y * Rnd()
  7. Form2.Show
  8. secStop = Timer + 0.1
  9. Do
  10. DoEvents
  11.     Loop Until Timer > secStop
  12. Loop
  13. End Sub
for that code i need same thing. i need to open new windows without closing previous. but it just reopens form2 and moves it around the screen.
Sep 30 '07 #7
jrtox
89 New Member
Hello,
I do made a program that multiply N times but its an Object,(Label,textbox,buttons), not a Form. i tried and its quite Difficult...

what is your purpose of Showing your FORM2, N TIMES?
maybe we can do an alternative.

regards..
ervin
Oct 1 '07 #8
Ali Rizwan
925 Contributor
Well almost :)
actually i have two forms, form1 and form2
i would like to open form2 when i click on command button.
thats easy.
BUT if i click again command button, i want it to open form2 again, without closing previously opened form2 window aka id like to open form2 "n" times.
or is there a way to create another window when i click command button?

Actually id like to make simple notebook. when i click button on main form, it opens a window where i can write, if i click again, it opens another one without closing previous window.

and yeah id like to bay back to a friend who made joke on me so i would modify second copy of that program do do something else.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Do
  3. x = Rnd() * 11000
  4. y = Rnd() * 11000
  5. Form2.Left = x * Rnd()
  6. Form2.Top = y * Rnd()
  7. Form2.Show
  8. secStop = Timer + 0.1
  9. Do
  10. DoEvents
  11.     Loop Until Timer > secStop
  12. Loop
  13. End Sub
for that code i need same thing. i need to open new windows without closing previous. but it just reopens form2 and moves it around the screen.
Yeah
There is a code by which we can open a form n times.
This code will make infinite number of forms. Form2 must exist.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim frm As Form2
  3.  
  4.   Set frm = New Form2  Call Load(frm)
  5.   Call frm.Show(vbModeless)
  6.  
  7.  
GOOD LUCK
ALI
Oct 1 '07 #9
djmauro
8 New Member
Set frm = New Form2 Call Load(frm)
it shows error on this line. And hilights Cell lstatement (syntax error, expected end of statement)
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Do
  3. x = Rnd() * 11000
  4. y = Rnd() * 11000
  5. Form2.Left = x * Rnd()
  6. Form2.Top = y * Rnd()
  7. Dim frm As Form2
  8.   Set frm = New Form2 Call Load(frm)
  9.   Call frm.Show(vbModeless)
  10. secStop = Timer + 0.1
  11. Do
  12. DoEvents
  13.     Loop Until Timer > secStop
  14. Loop
  15. End Sub
Oct 1 '07 #10
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

THIS IS ENOUGH FOR VB6

Expand|Select|Wrap|Line Numbers
  1.     Dim tfrm As New Form2
  2.     tfrm.Show
  3.  
REgards
Veena
Oct 1 '07 #11
djmauro
8 New Member
with this code it does open new form good for notebook app.

but now that other code where id like it to open it automatically, every time different location (command button triggers it).
code worked with form2.show (it just moved form2), but when i use
Dim tfrm As New Form2
tfrm.Show
it opens new each time i CLICK on button but it doesent do it automatically and it wont open in different locatio neach time.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Do
  3. x = Rnd() * 11000
  4. y = Rnd() * 11000
  5. Form2.Left = x * Rnd()
  6. Form2.Top = y * Rnd()
  7. Dim tfrm As New Form2
  8.     tfrm.Show
  9. secStop = Timer + 0.1
  10. Do
  11. DoEvents
  12.     Loop Until Timer > secStop
  13. Loop
  14. End Sub
Oct 1 '07 #12
djmauro
8 New Member
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. x = Rnd() * 11000
  3. y = Rnd() * 11000
  4. Form2.Left = x * Rnd()
  5. Form2.Top = y * Rnd()
  6. secStop = Timer + 0.1
  7. Do
  8. Form2.Show
  9.     Loop Until Timer > secStop
  10. End Sub
  11.  
cant edit last post :/
so made a little cleanup in the code.
tho i can find a way to implement
Expand|Select|Wrap|Line Numbers
  1. Dim tfrm As New Form2
  2.     tfrm.Show
if i replace Form2.Show than it wont change location each time.
i cand edit form2.left/top with tfrm.left/top i get duplicate declaration error.
Oct 1 '07 #13

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

Similar topics

2
by: Nenad Dobrilovic | last post by:
Hi, is there any way to find out how form was closed (by calling it's method Close() or by clicking on the 'close' button in control box)? Also, can I close the form in that way that Cloing/Closed...
6
by: Keith Smith | last post by:
I read in a Visual Studio .NET book that with C# it is now recommended to open database connections whenever you need to query a database as opposed to the traditional method of opening a database...
15
by: Rob Nicholson | last post by:
I'm starting to worry a bit now. We're getting the above error when two users hit the same database/page on an ASP.NET application using ADO.NET, talking to a SQL 7 server. The error is perfectly...
2
by: John | last post by:
Hi I am opening a dialog using; frmdialog = New frmdialognew frmdialog.ShowDialog() Is there a way to see if this dialog is already open to avoid opening multiple instances of it?
1
by: Angelos | last post by:
Hello there, I am very new to Javascript and before I explain what I want I'll tell you in a few words that I am trying to make a button on a WYSIWYG text editor (RichArea) that previews on a...
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
2
by: Luqman | last post by:
How can I open another WebForm in ASP.Net / VS 2005 without closing the Current Webform. I tried using Server.Transfer("Form2.Aspx",True) on Button_Click of Form1 but it close the current web...
3
by: godhulirbalaka | last post by:
Dear Sir/Madam, I am new vb 6.0 user. I am developing Shop Management Program. I have a main form with buttons and menus. when i click any button then respective form is open. I want to set a...
3
by: rajmohan.h | last post by:
Hi all, Suppose I have a string which contains quotes inside quotes - single and double quotes interchangeably - s = "a1' b1 " c1' d1 ' c2" b2 'a2" I need to start at b1 and end at b2 - i.e. I...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.