473,546 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use a user control's constructor which has parameters in design view mode in Visual Studio 2003? ,What is mechanism for generating InitializeCompo nent(){}?

I have a user control, it must set a property when it is just created, so I set it in its constructor, which has an parameter to specify the property .

For example:
public class ExecQuest : UserControl,IOl eClientSite,IDo cHostUIHandler
{
public ExecQuest(Type showType)
{
this.showType = showType;
}

}

Becuse showType property should not have default value and must be set at the begining, I don't want the user control class has default constructor with no arguements.

But When I put a user control on a form, seems auto-generated code in InitializeCompo nent() {} use control's default constructor.
I can only manually change code in InitializeCompo nent(), which ruined if I go to design mode and InitializeCompo nent() generated again.

public class frmExecute : System.Windows. Forms.Form
{
private void InitializeCompo nent()
{
this.EQ = new ExecQuest(Type. Builder); // manyally edited, it was this.EQ = new ExecQuest()
}
}

What is better way solve this problem?

In other words,
a.. What is mechanism for generating InitializeCompo nent(){}?
b.. How to use a user control's constructor which has parameters in design view mode in Visual Studio 2003?
Thanks a lot!
Ryan
Nov 16 '05 #1
0 1698

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1707
by: Ryan Liu | last post by:
I think there are two way to define user control. For example, I want to define a ComoBox with contains only AM, PM items. a.. One way I define a class extends System.Windows.Forms.UserControl, and put a ComboBox on it. b.. Another is Ithat I define a class (TimeSegmentComboBox ) extends ComboBox. Either way, I have code to populate AM,...
3
2374
by: Z D | last post by:
Hello, I've created a winform user control that, at some point in the default constructor, looks for a specifc file. When I try to load the user control to my winform's form during design time it gives an error saying that the file doesn't exist. Obviously the file doesnt exist yet because its only created at runtime!!
11
3191
by: Brian W | last post by:
Yet another editor problem To reproduce do the following 1) Open a Webform and switch to HTML edit mode 2) Enter the Following (include spaces) This is some text before <asp:hyperlink id="hl1" runat="server " navigateurl="http://www.microsoft.com">This is my link</asp:hyperlink> And this is my text after the Hyperlink
5
3145
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access the code variable that are supposed to be linked to the contained controls. It runs fines when everything is contained in a single web form project....
10
2325
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, Obtaining Data Based Upon Multiple Selections From a ListBox... I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual Studio Webform. I wish obtain various records from My_Store_Procedure
8
2098
by: Ravi Ambros Wallau | last post by:
Hey guys: What can I do when an "Error Creating Control" is displayed on the form (instead of the control), and a tooltip indicating the error never is displayed? Is there some log, some hidden message, some entry in registry where a log is created (or that enables a log, trace, dump or whatever)... I'm a little bit frustated with this error...
0
265
by: Adis | last post by:
Hi, My purpose consists on filtering the fields "years" and "clients" of a project WinForm, in a similar way to as I make it without any problems in a previous project ASP.NET. The filtering task must be on the server side because my database is very extensive and, in this case, filter with Dataview
1
1524
by: Tony Johansson | last post by:
Hello!! I use VS 2003 and C#. I have sent several mail even tried with crossgroup because I want to find out if my problem is a bug in .NET or if .NET doesn't support what I do. It's only one of these left I suppose. I use project reference where a need to.
0
3922
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something like this is a bug or that .NET doesn't support what I trying to do. I hope that one that is is microsoft certified read this because this must be a...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.