|
//below is my code , i want to add one entry
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration("AppDomain.CurrentDomain.BaseDirectory +"..\\..\\App.config");
// Get the count of the Application Settings.
int appStgCnt = config.AppSettings.Settings.Count;
string asName = "AppStg" + appStgCnt.ToString();
// Add an Application Setting.
config.AppSettings.Settings.Add(asName,
DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString());
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of a changed section.
ConfigurationManager.RefreshSection("appSettings");
but instead of writing in app.config , it creates another app.config.config file, so why is it so??????
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
modified on Tuesday, September 16, 2008 5:02 AM
|
|
|
|
|
Mogaambo wrote: System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration("..\\..\\App.config");
is this path valid? Try to give full executable path or use the other overload ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel)
|
|
|
|
|
Yes it is, if i give wrong path then it gives error,
i used this way
(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\App.config")
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Check out this on MSDN[^]. It has an example doing what you want. The main page is in VB but scroll down to the community content section and someone has posted a C# translation. I've just tried it and it works.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
//I tried this code but the result is not reflecting in app.config
//WHY
// Get the configuration file.
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Add an entry to appSettings.
int appStgCnt = ConfigurationManager.AppSettings.Count;
string newKey = "NewKey" + appStgCnt.ToString();
string newValue = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
config.AppSettings.Settings.Add(newKey, newValue);
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of the changed section.
ConfigurationManager.RefreshSection("appSettings");
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Sorry about that - my bad! That example uses yourexename.config if release or yourexename.vshost.exe.config if debug.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Because it's Microsoft. They provide HUGE amounts of stuff but none of it actually works properly.
|
|
|
|
|
I had set the DetectUrls property of the richtextbox object to true. When I typed an URL address, the address would be automatically underlined and the color of the font would be in blue and when ever I move the cursor over the address, it will change from an "I beam" to a "hand".
However, when I clicked the url, nothing happened. I expected the Internet Explorer 's window to pop out. Can anyone tell me what should I do ?
|
|
|
|
|
Use the LinkClicked event of the RichTextBox and put in something like this:
System.Diagnostics.Process.Start(e.LinkText);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
|
You're welcome
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
|
what?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
He wants an "assing". Usually, you have to go to the gay side of town (or prison) for that.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
i have created a mail message object as
MailMessage ReadMail=New MailMessage();
i have a ndoc of type domino.notesdocument which i am assigning to ReadMail
ReadMail = (MailMessage)nDoc;
i no its an invalid cast...Can ne1 plz tell me how to cast it???
|
|
|
|
|
preetpal wrote: ndoc of type domino.notesdocument
Cast will succeed if domino.notesdocument is a subclass of MailMessage . If not how you are expecting a valid cast?
|
|
|
|
|
thx...i really dont have any clue on how to do....
can u suggest me any way???
|
|
|
|
|
Your question is not clear. Why do you want to cast something which is not mailmessage to MailMessage ?
|
|
|
|
|
You need to create a static method on your MailMessage class that tells the framework how to convert a lotes message to the MailMessage that you've created.
public static explicit operator MailMessage(NotesDocument nDoc)
{
//add your conversion code here
}
|
|
|
|
|
Hi,
how can I simple focus previous textbox when up arrow key pressed.
When down key pressed I use SendKeys.Send("{TAB}").
thanks,
Jure
|
|
|
|
|
Tavbi wrote: SendKeys.Send("{TAB}").
Shift + Tab is the key to go back to the previous focus. I am not sure, but it will be something like
SendKeys.Send("+{TAB}")
|
|
|
|
|
Thanks man, it works!!!
Jure
|
|
|
|
|
You are welcome
|
|
|
|
|
Here are some methods that you can use
SelectNextControl
GetNextControl
I don't know if they will scroll the form to the control or not. Use the ScrollControlIntoView method to scroll to the desired control.
Eslam Afifi
|
|
|
|