User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 397,803 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,456 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 1787 | Replies: 5 | Solved
Reply
Join Date: Jul 2006
Posts: 21
Reputation: lover99509 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
lover99509 lover99509 is offline Offline
Newbie Poster

how to pass a form to another form

  #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 10:56 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: West Yorkshire, England
Posts: 72
Reputation: purplegerbil is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
purplegerbil's Avatar
purplegerbil purplegerbil is offline Offline
Junior Poster in Training

Re: how to pass a form to another form

  #2  
Jul 31st, 2006
Hi,

A couple of ways you could dop this:

1. From Form2, you could

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.

Public intCopies as integer

Instead of using Dim, use Public

On Form1, under the Button - Click

intCopies = txtCopies.text

On Form2, under Load

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

CommonDialog1.ShowPrinter

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


Good Luck


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

Re: how to pass a form to another form

  #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  
Join Date: Apr 2005
Location: West Yorkshire, England
Posts: 72
Reputation: purplegerbil is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
purplegerbil's Avatar
purplegerbil purplegerbil is offline Offline
Junior Poster in Training

Re: how to pass a form to another form

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


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

Re: how to pass a form to another form

  #5  
Jul 31st, 2006
Thanx bro. purplegerbil it works thanx alot
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: how to pass a form to another form

  #6  
Jul 31st, 2006
Good Work Here PG
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 6:10 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC