Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

what control to use

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tarscher - 22 Feb 2007 13:15 GMT
Hi all,

I have an application that has a form (MainForm) with a tabcontrol. I
want to populate the tabs (3 tabs) with other controls. I prefer to
put those controls (3 controls) in different classes since this allows
me to break up the UI in functional parts.

Momentarily I'm using usercontrols on each tab but this has it's
issues. Mainly the MainForm designer doesn't work anymore since I pass
parameters to the constructors of the usercontrols.

Someone can advice me another control?

Thanks
Stijn
Bob Powell [MVP] - 22 Feb 2007 13:21 GMT
Don't pass parameters in the constructor of a user control and create
properties for your user controls that are used instead. In this manner
the properties may even be set at design time.

Signature

Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> Hi all,
>
[quoted text clipped - 11 lines]
> Thanks
> Stijn
Tarscher - 22 Feb 2007 13:32 GMT
On 22 feb, 14:21, "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net>
wrote:
> Don't pass parameters in the constructor of a user control and create
> properties for your user controls that are used instead. In this manner
[quoted text clipped - 28 lines]
> > Thanks
> > Stijn

Thanks for the fast reply.

I don't quite understand "create properties for your user controls
that are used instead". My user controls need a cennctionstring. The
connection string is stored in the app.config. How do I get the
connectionstring in the user control?

thanks
Simon Harvey - 22 Feb 2007 16:59 GMT
> On 22 feb, 14:21, "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net>
> wrote:
[quoted text clipped - 35 lines]
>
> thanks

Do something like:

class MyControl{
    private string connectionString = null;

    // Property Accessor
   
    public string ConnectionString{
        get{
            return connectionString;
        }
        set{
            connectionString = value;
        }

    }

    // Note - no params
    public MyControl(){

    }
}

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.