Hi Nicholas:
I'm not using it a constructor. I'm using it in a property like so...
public static string _connectionString = String.Empty;
public static string ConnectionString {
get {
if( _connectionString == String.Empty ) {
_connectionString =
ConfigurationManager.ConnectionStrings["RepairShop.Properties.Settings.BaseRepairShopConn ectionString"].ToString();
}
return _connectionString;
}
}
I've tried it in other places without success. I'm at my wits end.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:uo*************@TK2MSFTNGP03.phx.gbl...
Charlie,
Can you do this somewhere else other than the constructor of your code?
It's not that the WinForms designer is broken, but rather, you don't have
access to the app config file at that time when the designer is trying to
render your form. An exception gets thrown in the constructor, and the
designer doesn't know what to do.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Charlie@CBFC" <ch*****@cbfconsulting.comwrote in message
news:%2*****************@TK2MSFTNGP05.phx.gbl...
>Hi:
Program runs and compiles fine, but WinForms designer breaks when using
this line of code...
ConfigurationManager.ConnectionStrings["RepairShop.Properties.Settings.BaseRepairShopConn ectionString"].ToString();
It says "Object reference not set to an instance of an object". How then
do I access app.config?
Thanks,
Charlie