473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS Code Auto-erasing

Hi All:

I am having a problem with visual studio automatically erasing my code. I
thought it was a fluke at first, but it KEEPS HAPPENING. I have a string
variable for a data connection that I do not assign a value until the
application loads (Reason: I do not know where my users are going to install
their applications, so it does it dynamically). This value is put into the
region of the Windows Form Designer generated code.

Problem is, that everytime that I modify a form after this code is put in.
The oledbconnection connection string disappears. All the other code
remains, but if put the code back and modify the form latter the connection
string disappears again. Okay, what do I do to fix this?

Rachel
Nov 21 '05 #1
2 1183
Simple answer is to remove the code from this area.
Anything you put in there will be wiped and rewritten automatically by the forms
designer.
You can place code after the InitializeCompo nent call in the Sub New.
Or you might try putting it into the Form Load Event or some more appropriate
place.

Gerald

"Rachel" <Ra****@discuss ions.microsoft. com> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
Hi All:

I am having a problem with visual studio automatically erasing my code. I
thought it was a fluke at first, but it KEEPS HAPPENING. I have a string
variable for a data connection that I do not assign a value until the
application loads (Reason: I do not know where my users are going to install
their applications, so it does it dynamically). This value is put into the
region of the Windows Form Designer generated code.

Problem is, that everytime that I modify a form after this code is put in.
The oledbconnection connection string disappears. All the other code
remains, but if put the code back and modify the form latter the connection
string disappears again. Okay, what do I do to fix this?

Rachel

Nov 21 '05 #2
On Wed, 11 Aug 2004 12:01:06 -0700, Rachel wrote:
remains, but if put the code back and modify the form latter the connection
string disappears again. Okay, what do I do to fix this?


Where in the windows generated code are you placing your string? That
section can be regenerated when the form is change, hence the warning at
the top. If you place your string *after* the call to InitializeCompo nent,
it should not be removed when the code is regenerated.

The best solution would be to add an application configuration file to your
project and put your connectection string there.
--
Chris

dunawayc[AT]sbcglobal_lunch meat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #3

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

Similar topics

0
1661
by: Steve Barker | last post by:
Hi guys! In Visual Studio .NET, I like to enable auto-generation of XML documentation on the project properties screen, by adding an XML file name under "Configuration Properties" --> "Build" --> "XML Documentation File". This way, I get warnings in the task list about public methods I have written that do not have XML comments (launched by...
20
2838
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
6
5056
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which...
4
13172
by: Never Best | last post by:
I have an application. I want it so when the user minimizs the window it goes into the system tray, and while in the system tray I don't want it in the "Alt-Tab" list. (When the program starts it starts in the system tray aswell; only shows main window if they double click). Currently to achive this when the user minimizes I have to set...
2
7967
by: Greg Strong | last post by:
Hello All, Is it possible to change table field lookup properties in code? I've been able to change other field properties in code, however so far no luck with field lookup properties. What I've done for test purposes is use a text input file for the table field lookup properties. I thought that I'd start first by just changing the...
135
7399
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about which is better. It has become what's known as “religious war” — a heated fight over trivia. In this essay, i like to explain what is the...
239
10115
by: Eigenvector | last post by:
My question is more generic, but it involves what I consider ANSI standard C and portability. I happen to be a system admin for multiple platforms and as such a lot of the applications that my users request are a part of the OpenSource community. Many if not most of those applications strongly require the presence of the GNU compiling...
2
7328
by: pamelafluente | last post by:
Hi guys, I am trying to add some code in the body of a document just after it has loaded. I have the following code (this is referenced in an html page). When I click on the document I receive this error: "realSrc is null" I guess I am not doing correctly the part of dynamic code. Can you help
3
4143
by: DaveO | last post by:
My apologies for individually posting this to multiple newsgroups - my ISP won't allow multiple posts. I'm not a C programmer, so I'm looking for someone to modify some UnZip code for a Self-Extracting stub. I have a copy of the source code of the UnZipSFX utility, also available from :...
3
2717
by: dotcom | last post by:
hello, i am sending whole javascript code(it is for freezing html header) it works fine eith IE but not firefox scroll bar does not come var divContent = null; var divHeaderRow = null; var divHeaderColumn = null; var divHeaderRowColumn = null; var headerRowFirstColumn = null; var x;
0
7701
marktang
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, well explore What is ONU, What Is Router, ONU & Routers main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
jinu1996
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...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7979
tracyyun
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...
1
5514
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
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
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
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.