Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 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 31st, 2006, 07:14 PM
ivj ivj is offline
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I re-use an object created in designer?

Ok say I have one form where I create some DataSet (in the visual editor, so it appears at the bottom). Now I want to re-use that exact same instance in a different control, so that I can see it in the visual editor as well (so I can easily bind it to any properties).

How can I achieve that?

Biggest problem is that I can't figure out a way to prevent VS2005 from instantiating any objects you create in the visual editor, so 2 DataSets = two separate instances. Any suggestions? Or am I gonna have to bind ever freaking control by hand?

 
Old May 31st, 2006, 09:53 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Not sure what you are asking, but it sound like you want to use a UserControl for reuse.
 
Old June 1st, 2006, 01:24 AM
ivj ivj is offline
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no no. Ok let me put it this way, a different approach, similar result.

I create a form MyForm.cs. VS2005 creates MyFormDesigner.cs.

Inside MyForm.cs in the MyForm class I add the following:

public List MyList = null;

Now, how can I make that variable accessible via the Windows Forms Designer (you know the pretty WYSIWYG where you can drag things around) - either in Properties, or as an object on that bar below your form.

 
Old June 1st, 2006, 08:36 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can't and why would you? A variable is a variable and is not a visual object, so how would you expect it to show in the desigener?

 
Old June 1st, 2006, 02:39 PM
ivj ivj is offline
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

" You can't and why would you? "

So I don't have to copy-paste the following 100 times for every textbox:

textedit.DataBindings.Add( new Binding( "text",mylist","someVar") );

I thought the whole idea of the designer is to make the whole code more managable, so wtf is the point if I can't even use the visual databind features unless I re-create my data source on every freaking control and form.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Designer to UI Designer jitesh82 BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 April 16th, 2011 01:04 AM
Class Designer and Object Test Bench James Evans BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 2 January 21st, 2009 05:23 PM
Can't see designer code katsarosj ASP.NET 2.0 Basics 1 January 26th, 2006 11:36 PM
Control designer hhuberlant BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 December 22nd, 2005 06:02 PM
Setting stylesheet for dynamically created object tgopal Javascript 2 September 6th, 2004 11:47 PM





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