how to pass a form to another form

Thread Solved

Join Date: Jul 2006
Posts: 21
Reputation: lover99509 is an unknown quantity at this point 
Solved Threads: 1
lover99509 lover99509 is offline Offline
Newbie Poster

how to pass a form to another form

 
0
  #1
Jul 31st, 2006
Hi guys, i have a problem in vb6 .
lets say i have a command button named print in form1 then after clicking the print button it will transfer me to form2 which will control the number of copies,quantity and these things of printing options. The problem is how to pass form1 to form2 and then based on the selection of the user in form2 i will print form1

so how to manipulate form1 in form2 ?? any hints or help
can i pass it as an object(cascading)??
Last edited by Comatose; Jul 31st, 2006 at 11:56 am.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 75
Reputation: purplegerbil is an unknown quantity at this point 
Solved Threads: 6
purplegerbil's Avatar
purplegerbil purplegerbil is offline Offline
Junior Poster in Training

Re: how to pass a form to another form

 
0
  #2
Jul 31st, 2006
Hi,

A couple of ways you could dop this:

1. From Form2, you could

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. label1.caption = Form1.Text1.Text

Thisill copy the text from Text1 on Form 1 to the Label on Form2

2. Add a Module to your script

Within the module define the variables to be used across the two forms.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public intCopies as integer

Instead of using Dim, use Public

On Form1, under the Button - Click

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. intCopies = txtCopies.text

On Form2, under Load

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. lblCopies.caption = intCopies


Hope this makes sense.

--BUT--

Why not you the print control to get printing information

Right click the toolbar and select Components
Scroll down the list and tick - Microsoft Comon Dialog Control

Double Click the control to put it onto your form

Under your Print button - Click

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. CommonDialog1.ShowPrinter

You can now use CommonDialog1.copies etc to get the printer info.


Good Luck


pG
purpleGERBIL
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 21
Reputation: lover99509 is an unknown quantity at this point 
Solved Threads: 1
lover99509 lover99509 is offline Offline
Newbie Poster

Re: how to pass a form to another form

 
0
  #3
Jul 31st, 2006
Thanx for replay ,

But when i tried to use this way you wrote

* Right click the toolbar and select Components
Scroll down the list and tick - Microsoft Comon Dialog Control

Double Click the control to put it onto your form

Under your Print button - Click


Code:
CommonDialog1.ShowPrinter


You can now use CommonDialog1.copies etc to get the printer info.


------------------------------------------

BUT when i press the print button it displays the printer info e.g. num of copies and these things. But when i press print then it does not print that means nothing to print nothing goes to the printer. The question is how to specify that i want to print form1 using Microsoft Comon Dialog Control?

i did your steps but still the same problem but when i write in the click event of "print button" form1.printform it prints the specified form eventhough its size is small!!
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 75
Reputation: purplegerbil is an unknown quantity at this point 
Solved Threads: 6
purplegerbil's Avatar
purplegerbil purplegerbil is offline Offline
Junior Poster in Training

Re: how to pass a form to another form

 
1
  #4
Jul 31st, 2006
Have a look at this


pG
Last edited by purplegerbil; Jul 31st, 2006 at 8:18 am. Reason: Error in code
Attached Files
File Type: zip PRINT TEST.zip (1.5 KB, 11 views)
purpleGERBIL
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 21
Reputation: lover99509 is an unknown quantity at this point 
Solved Threads: 1
lover99509 lover99509 is offline Offline
Newbie Poster

Re: how to pass a form to another form

 
0
  #5
Jul 31st, 2006
Thanx bro. purplegerbil it works thanx alot
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: how to pass a form to another form

 
0
  #6
Jul 31st, 2006
Good Work Here PG
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC