Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: NullReferenceException when using Delegate Pin
cocoonwls17-Apr-08 16:12
cocoonwls17-Apr-08 16:12 
GeneralRe: NullReferenceException when using Delegate Pin
Christian Graus17-Apr-08 16:22
protectorChristian Graus17-Apr-08 16:22 
GeneralMadness? IDisposable and template/factory methods Pin
Roger Alsing17-Apr-08 12:44
Roger Alsing17-Apr-08 12:44 
QuestionI am getting 0x00000096 type messages. Pin
dougins17-Apr-08 11:45
dougins17-Apr-08 11:45 
AnswerRe: I am getting 0x00000096 type messages. Pin
dougins17-Apr-08 11:58
dougins17-Apr-08 11:58 
QuestionHow to change the "Close" text string which is displayed when the user hovers over the Windows Form ControlBox 'X' Close button Pin
jack8091817-Apr-08 10:08
jack8091817-Apr-08 10:08 
AnswerRe: How to change the "Close" text string which is displayed when the user hovers over the Windows Form ControlBox 'X' Close button Pin
Ravenet17-Apr-08 15:41
Ravenet17-Apr-08 15:41 
QuestionConfig file in DLL C# projects Pin
ARol17-Apr-08 9:15
ARol17-Apr-08 9:15 
Hello all.

I have a c# solution that has 4 different projects, each project has an app.config file. I am able to change the Connectionstrings section for my startup project but not for the other projects and I need to do that.
But the problem I think is that the other projects are DLL so there's no config file for them in the BIN folder and NullReference exception is thrown.

But I need to change the connectionstring at runtime
How can I achieve that?

I already tried sending the parms like this:

ModifyCnnStr("N1.Properties.Settings.DBConnection", "new cnnstr");
ModifyCnnStr("N2.Properties.Settings.DBConnection", "new cnnstr");
ModifyCnnStr("N3.Properties.Settings.DBConnection", "new cnnstr");

but it doesn't work.


This is the function i have:

namespace N1

public static class CryptConfig
{
public static bool ModifyCnnStr(string settingName, string newCnnStr)
{
try
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.ConnectionStrings.ConnectionStrings[settingName].ConnectionString = newCnnStr;
config.Save(ConfigurationSaveMode.Full, true);
ConfigurationManager.RefreshSection("connectionStrings");
return true;

}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
return false;
}
}
}
}

I also tried having this class in each project but still wouldn't work. I need to use the config's connectionString because I already have lots of datasets using the connectionString.
Help please

Thanks
Generalthe problem write to file is still continuing:( Pin
wwwxyz17-Apr-08 8:52
wwwxyz17-Apr-08 8:52 
GeneralRe: the problem write to file is still continuing:( Pin
wwwxyz17-Apr-08 11:21
wwwxyz17-Apr-08 11:21 
GeneralRe: the problem write to file is still continuing:( Pin
BoneSoft17-Apr-08 11:49
BoneSoft17-Apr-08 11:49 
GeneralRe: the problem write to file is still continuing:( Pin
wwwxyz17-Apr-08 19:41
wwwxyz17-Apr-08 19:41 
GeneralRe: the problem write to file is still continuing:( Pin
wwwxyz17-Apr-08 19:59
wwwxyz17-Apr-08 19:59 
GeneralRe: the problem write to file is still continuing:( Pin
BoneSoft18-Apr-08 5:24
BoneSoft18-Apr-08 5:24 
GeneralDataTable remains empty on button finish click Pin
vanessa12317-Apr-08 8:21
vanessa12317-Apr-08 8:21 
QuestionSpelling Test Pin
dennycrane17-Apr-08 7:37
dennycrane17-Apr-08 7:37 
GeneralRe: Spelling Test Pin
Edmundisme17-Apr-08 7:54
Edmundisme17-Apr-08 7:54 
GeneralRe: Spelling Test Pin
led mike17-Apr-08 8:00
led mike17-Apr-08 8:00 
GeneralRe: Spelling Test Pin
dennycrane17-Apr-08 8:00
dennycrane17-Apr-08 8:00 
GeneralRe: Spelling Test Pin
ChrisKo17-Apr-08 8:17
ChrisKo17-Apr-08 8:17 
GeneralRe: Spelling Test [modified] Pin
Edmundisme17-Apr-08 9:16
Edmundisme17-Apr-08 9:16 
GeneralRe: Spelling Test [modified] Pin
dennycrane17-Apr-08 9:37
dennycrane17-Apr-08 9:37 
GeneralRe: Spelling Test Pin
Edmundisme17-Apr-08 9:55
Edmundisme17-Apr-08 9:55 
GeneralRe: Spelling Test Pin
dennycrane17-Apr-08 10:19
dennycrane17-Apr-08 10:19 
GeneralRe: Spelling Test Pin
Edmundisme17-Apr-08 10:29
Edmundisme17-Apr-08 10:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.