When you create a Windows app, you get a two files pre-made each with
a partial class of the same class, and you also get a c'tor of your
class which calls InitializeCompo nent(). I guess this is cool, since
VB hides this, I believe.
I am sure it is ok for me to populate the c'tor with more of my own
stuff, as long as I don't remove the InitializeCompo nent call, right?
I am always a bit uneasy messing with desginer generated code, but I
think I just convinced myself it is perfectly ok to have MY c'tor do
as I please.
Zytan 2 1725
Sure. That's why it's visible. And it's also useful place for a few things.
But there are things you should not do there. For example you should not
touch controls, wire events and things like this.
The class is still being created so be careful.
And try to put your code after the InitializeCompo nent() call. It's safer.
The *core* of the designer code is in the .designer.cs file that is not to
be touched, usually.
"Zytan" <zy**********@y ahoo.comha scritto nel messaggio
news:11******** **************@ t69g2000cwt.goo glegroups.com.. .
When you create a Windows app, you get a two files pre-made each with
a partial class of the same class, and you also get a c'tor of your
class which calls InitializeCompo nent(). I guess this is cool, since
VB hides this, I believe.
I am sure it is ok for me to populate the c'tor with more of my own
stuff, as long as I don't remove the InitializeCompo nent call, right?
I am always a bit uneasy messing with desginer generated code, but I
think I just convinced myself it is perfectly ok to have MY c'tor do
as I please.
Zytan
Sure. That's why it's visible. And it's also useful place for a few things.
But there are things you should not do there. For example you should not
touch controls, wire events and things like this.
The class is still being created so be careful.
Yes, good point. I am just going to put the initialization of my
logfile in there, since this should be the first code that is run in
the program (that is, of any code that I write).
And try to put your code after the InitializeCompo nent() call. It's safer.
The *core* of the designer code is in the .designer.cs file that is not to
be touched, usually.
Yes.
Thanks,
Zytan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ali Eghtebas |
last post by:
Hi,
I wanted to insert linebreaks in the tooltip property of some of my
controls.
I simply altered the designer generated code in InitializeComponent:
Me.MyTooltip.SetToolTip(Me.TextBox1, "Text line 1" & vbCr & "Text line 2.")
But whenever I change back to desinger I get this error in the Task List:
"The variable 'vbCr' is either undeclared or was never assigned."
|
by: Marina |
last post by:
Hi,
I have a component that implements ISupportInitialize, so the code in
InitializeComponent is something like:
theComponent.BeginInit()
' Set theComponent properties
theComponent.EndInit()
|
by: pepsi |
last post by:
A wierd problem is occuring in asp.net. I have few web
pages and at times some of the code just disappears from
InitializeComponent() in designer generated code. Lets say
I have these four lines in InitializeComponent.
private void InitializeComponent()
{
this.btnCountyVSalesman.Click += new System.EventHandler
(this.btnCountyVSalesman_Click);
|
by: JakeC |
last post by:
when i put my code in initializecomponent
it gets erased.
where is the best place to put my page oninit code
a)oninit
b)initializecomponent
when i put in
#region Web Form Designer generated code
|
by: DC Gringo |
last post by:
Hi, I'm trying to use a custom action to modify a database (rather than
create one) using the VS.NET '03's help example called "Custom Action to
Create Database During Installation".
I've made two modifications to the sample in the document...both are in the
"Protected Sub AddDBTable" (towards the bottom).
I've changed
' Creates the database.
| |
by: Lars Netzel |
last post by:
Hi!
I have a property of a Control (a button I'm making) that makes it possible
for the user to choose what shape a button should have... Round, Square,
Triangle...
How do I in the designer view (in the properties window) make the user have
a list of the shapes I intend to add to this control, to choose from?
If you create a Boolean property the list in designerview will automatically
show "True, False" but how do I add my own...
|
by: Zach |
last post by:
I have a situation similar to what you see in Visual Studio Options
menu. A Tree View on the left, and depending on what type of node you
click it dynamically loads a panel into the right hand side of the
form.
It would be really nice if I could design all possible right hand side
panels in the forms designer, then have some way to tell the framework
"load the form represented by the class SuchAndSuchForm". What I have
to resort to...
|
by: tony |
last post by:
Hello!
When exactly is it important or advisable to use this form load event
handler compare to using the C-tor.
For example here I create an event handler called dataBoundGridForm that is
called when the form is loaded.
this.Load += new System.EventHandler(this.dataBoundGridForm_Load);
I mean if I compare form load with the C-tor I think that it's enough to put
the code into the C-tor instead
|
by: cj |
last post by:
In a project done in 2003 about a year ago I was told to add the
SocketWrench code below into the Windows Form Designer generated code
area as shown below.
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |