Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 17th, 2004, 02:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Copying (NOT inheriting) a form

At run time, I am passing a populated form to a class that will print the form (making up for the PrintForm functionality that MS took away in .NET). I want to eliminate the form's background image (buttons, etc., too) prior to printing. When done, I want to just throw the copied form away - I don't want to have to reset all the original properties.

The print form code works, but the screen flashes when I remove the background image, because it appears as though the reference in the class points to the original form instead of a copy. Changing the parameter reference to BYVAL doesn't seem to make a difference, nor does setting a class variable to the passed parameter.

So how can I copy this form to a working variable where I can manipulate the interface without changes actually appearing on the user's desktop?
 
Old May 18th, 2004, 06:26 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Default

What I'd do, and it's a bit of a pain, is create a new form and set the display properties (i.e. background colour, foreground colour, etc) to be that of the form that's been passed in. Add all controls that you want to print to this form. Then print this form and dispose of it.

Either that, or you could create a new class called something like 'Clonable Form' which inherits from Form but exposes the IClonable interface. Then make all your forms inherit from this rather than System.Windows.Forms.Form. Not sure how well, or if, this would work, it's just an idea that occurred to me as I was writing the reply.
The Following User Says Thank You to jaucourt For This Useful Post:
Ron Howerton (February 22nd, 2013)
 
Old May 18th, 2004, 07:29 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default

Thanks for the suggestions, but I think it'd be easier to tell the end users they'll have to put up with the flash.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inheriting IE skin into C# toolbar arif134 C# 0 July 31st, 2007 11:50 AM
Inheriting SqlDataReader and new KeyWord software_developer_kk C# 2 June 28th, 2007 08:17 AM
Inheriting Web Page tanusree_ghosh General .NET 0 December 20th, 2004 02:04 PM
classes extending and inheriting jlong Beginning PHP 2 July 7th, 2003 02:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.