473,387 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

InitializeComponent() question

Have a basic question I am sure the answer is out there.

How do you stop the Visual Studio C# Designer from removing lines out
of the Initialize component that do not have a "this." in front of
them.

When I switch from the code view to the designer view it removes my
lines, which is a pain in the rear end. I have tried with static
variables using the namespace..but these are removed too in some
cases.

thanks

Nov 16 '05 #1
1 1708
Hi talljames,

InitializeComponent is not the place where you should write your custom
code. The designer will keep rewriting that portion, deleting your code.

Put your init code following the "//TODO:" comment you could see just after
InitializeComponent is invoked in the Form_Load event.

HTH,
Rakesh
"talljames" wrote:
Have a basic question I am sure the answer is out there.

How do you stop the Visual Studio C# Designer from removing lines out
of the Initialize component that do not have a "this." in front of
them.

When I switch from the code view to the designer view it removes my
lines, which is a pain in the rear end. I have tried with static
variables using the namespace..but these are removed too in some
cases.

thanks

Nov 16 '05 #2

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

Similar topics

0
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...
1
by: Fulcrum | last post by:
My program has 4 tabs with a few usercontrols that each have a lot of controls on them. Added to that a few oleDb database connections etc. Because of this the program spends a lot of time during...
3
by: Tabo | last post by:
when i build the project using C#, the code in InitializeComponent lost sometimes. Is it a bug?? if yes, can some method fix it? thanks for help. Tabo
8
by: edster | last post by:
A *lot* of our teams code is being deleted from the InitializeComponent() section of a winform, such as Grid settings, event handler hooks, layout settings etc. This mainly seems to happen to 3rd...
2
by: Craig | last post by:
Is there any side effects to skipping InitializeComponent() and calling a custom method instead? I actually layed out the form, copied the InitializeComponent() method and put it in layout1()...
1
by: muser8 | last post by:
I've encountered a very bizarre situation: a form's Initialize Component is not called and excution doesn't reach the code immediately following the call to initialize component. So in the...
6
by: Winshent | last post by:
I have read many threads which indicate that this was a problem with version 2002. Why should i be suffering this? I am using VB.NET 2003 Standard Edition... is it still a problem with 2003? ...
3
by: Scott Kilbourn | last post by:
Hi, I added some custom code to the InitalizeComponent function of a control that I'm working on. Every once in a while, I've noticed that the code that I added disappears. I finally tracked...
6
by: titan.nyquist | last post by:
Right after InitializeComponent() is run, I do some error checking... when an (very bad) error occurs I show it to the user and I want to close down the application. QUESTION: How do I close...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.