views:

41

answers:

1

Here's the setup:

I have some controls with text fields that I wish to be blank. So I might have, in my designer file:

someControl.HeaderText = ""

or

someControl.HeaderText = Properties.Resources.blank_string

THis only seems to happen when i'm trying to specify a blank string for a text or headertext property to a control.

If I open up the designer file (perhaps becuase I was searching something) and close/save all, VS will sometimes replace my "" or Properties.Resources.blank_string

with:

global::ProjNameSpace.Properties.Resources."SomethingCompletelyRandomHere!!!!"

Awesome!

I sometimes won't catch this until I start screwing around with my application and notice strange strings showing up in places where there should be none.

WHY is this happening?

Actually, what I think it's doing is a replace. I have a bunch of entries in my default string resources file that are all blank (populated ones are the in the translated resource files). So I think it's going through and finding "" or blank strings and just saying, "hey, looks like u got some other blank strings in this resource file, let's just swap this one with this one, Cool! I'm Microsoft!"

+1  A: 

You shouldn't be editing the designer file. It's auto generated and visual studio will happily clobber anything you put in there.

if something needs to be blank either set the default values in the .aspx/.ascx file or in your codebehind.

As a matter of fact, all the designer files i've seen start off with:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
Chris Lively
I've never used 2008, but would be downright mad if the behavior was other than 2005 -- if you hand-edited the backing file your changes took.
Joshua
I'm not editing the designer file. This happens if if I set the Text or HeaderText property to nothing "blank string" in the designer view.
Nick