|
Not really a 'solution', I always read the keys from file when I need them, so I always get the latest values from the config.
Maybe you can tell us in more specific why you need to restart the application when you have made changes to the config file.
|
|
|
|
|
I have added the connection string for the database in the
app.config file when the application starts for the first time.
But when i add and later try to access the connection string from
the file it returns null, i debugged the whole application,
The file is modified but the object through which i read the file does not
displays the newly added value.
How have u done it?
can u tell me the procedure to do that.
I want to add a connection string value to the app.config file
when the application is started.
and then read this value later in the application without restarting it.
Thanks,
Pramod
|
|
|
|
|
As I wanted to change the key values in my apps during execution and reload the key values as needed, I use a custom class to read and write to the config file.
You can do a search on CP, there are a few of these custom classes, and see which one is more suitable for your needs.
|
|
|
|
|
I'm referring to a desktop application.
|
|
|
|
|
I needed to access an assembly, which I did by loading it into another AppDomain.
Next, I unload the AppDomain. Now when I try to open up that dll for writing it tells me that the file is being used by another process. I thought that the file got unloaded once the AppDomain was unloaded. That is the only reason I loaded the dll into another AppDomain, so that I could unload it and allow it to be overwritten afterward.
Here is my code. The dll is in the directory that the main executable is running in. This is the only way I got the domain to load the assembly. Once the domain loads the assembly a FileStream cannot be opened for writing on that file. It makes no sense because I unload the domain :
AppDomainSetup aps = new AppDomainSetup();<br />
<br />
aps.ApplicationBase=@"myapplocation";<br />
AppDomain domain = AppDomain.CreateDomain("My New Domain",null,aps);<br />
string apploc = @"myexecuting assembly location";<br />
domain.ExecuteAssembly(apploc);<br />
<br />
Assembly ass = domain.Load("AdCenter");<br />
<br />
AppDomain.Unload(domain);<br />
<br />
FileStream fs = new FileStream("AdCenter.dll", FileMode.Open, FileAccess.ReadWrite);
Thanks
-- modified at 15:59 Thursday 30th March, 2006
|
|
|
|
|
I don't think that there's any guarantee that the domain has been unloaded because the GC could still retain a reference to it.
Or then again maybe I'm confusing it with something else, although it's still worth checking up on.
Ed
|
|
|
|
|
Check the VS.NET output window, when the 'apploc' assembly loads. What is happening most likely that one of the Types in AdCenter.dll is crossing the domain boundry and effectively locking it. If that is the case, you will have to be a bit more clever how you execute the additional appdomain, it will depend on what your code does, so I cant help you with that.
|
|
|
|
|
AppDomain.Load will load the assembly BOTH in the target domain AND current domain. AppDomain.Load is for calls through COM from unmanaged code only.
Use AppDomain.CreateInstanceAndUnwrap to create an instance of a MarshalByRef class in your main assembly in the target domain. That class then can use Assembly.Load to load additional assemblies that should be active only in the target AppDomain.
|
|
|
|
|
I'm not sure I understand what you're saying. First off, AppDomain.CreateInstanceAndUnwrap loads the assembly into the both domains just as AppDomain.Load does. Also I don't get how I would be able to use that class to call Assembly.Load since the class that is returned is the class object that I instantiated.
|
|
|
|
|
Ok, I get what you're saying, if my class inherits MarshalByRefObjectthen I can load the assembly inside of that class. Since my class inherits MarshalByRefObject it get returned as a proxy.
|
|
|
|
|
Hello
I have what I hope will be a simple question...I'm trying to build an application in which I have a tree control on the left side of my form that will control swap which form is shown on the right (basically I'm hoping to reproduce the tab control using a tree as it's selection method). I've tried just hiding and showing the controls but this is not a valid solution as i add more options to the tree...I've also moved panels around but ran into the same extendibility problem. I'm sure there is a way to create separate forms and simply overlay them on the currently displayed form but I can't figure it out...please help.
Thanks
Kev
|
|
|
|
|
KTreanor wrote: I've tried just hiding and showing the controls but this is not a valid solution as i add more options to the tree...
I recommend using UserControl s, each of which contains the appropriate collection of controls that need to be shown when an item is selected in the tree control. That way, you just have to hide all the UserControl s and reveal the selected one. The UserControl effectively functions as a tab.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I need help to make an application which can both send and receive netsends from LAN. It will be like winmessenger. I know the sending part, thanks to the site, don't have any clue about how to proceed for receiving netsends in my application textbox.
|
|
|
|
|
Wouldn't writing your own TCP/IP Server / Client be more sensible?
Ed
|
|
|
|
|
Ed.Poore wrote: Wouldn't writing your own TCP/IP Server / Client be more sensible?
I can't help it. it is my project, i coudn't change it. i've to simulate or rather make my own winmessenger or winpopup.
|
|
|
|
|
sharmaabhishek wrote: I can't help it. it is my project, i coudn't change it. i've to simulate or rather make my own winmessenger or winpopup.
Explain more clearly please?
Ed
|
|
|
|
|
i am supposed to make a winmessenger sort of application in C#, not a full fledged messenger(yahoo etc.).
it should follow the net send command, when somebody messages me through net send, or winmessenger, the message should appear in my application.
when i send a message to intended peer(not having this application), the message should popup as regular net sends or winmessenger messages.
|
|
|
|
|
Take a look at this
It might be a possibility, there are some freeware apps out there which do this (google them) so they might be a good starting point.
Sorry I can't help further at the moment.
Ed
|
|
|
|
|
thanks,
well i'm still looking for the solution because my C# version doesn't support System.messaging,
i've googled out for freewares, got a lot for sending messages, but none for receiving messages.
|
|
|
|
|
|
|
Hi everybody,
I want to create an application that will be similar to Visio, I mean the Interface. I want to create a control, so I can drag and create it to the parent windows or the designer window, I can than do some editing stuff to it, of course inlcude the selection, resize, move to it.
Does anyone has some idea and/or examples about it!!
Thanks!
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
Try searching CP for drag & drop articles. As for the user-interface there are plenty of free controls which would do something like what you want.
Take a look at Divelements as they have a control which does this, but it's not free anymore. If you need a free one then it's just a matter of hunting the internet.
Try looking at the controls that SharpDevelop uses for its interface.
Ed
|
|
|
|
|
Dear All,
Now I just finished my winform application. And a part of that is to
send email reminder to the users. It's working fine in the server that with
SMTP service in Windows 2003.
But now the user wants to used the Linux server to send email messages.
(already installed the SMTP service in that). Unfortunatelly one error shown
after the sending funciton invoked.
It shows "Pickup directory is not existed,x,x,x,,"
It's well known that in SMTP service of windows system. There are
several folders in the C:\Inetpub\MailRoot, "Picker,BadMail,Queue,etc.".
When one email message is created. It would first to into "Pickup" folder.
And then changes to "Queue" folder. And then sent out.
But seems Linux system didn't has those folder or the architecture is
not same as windows system. So it prompts errors.
Should I goto change the email function and didn't use the CDO object to
send emails? Change to used Jmail to send messages? Is this a solution for
me?
Let me describe this one again.
CDO + Email Function + SMTP Service (Windows 2003) <--Successed
CDO + Email Function + SMTP Service (Linux System) <--Failed
The program is still runs on the Windows 2003 system. Only changed SMTP
Server's content that in the configuration file to Linux System.
(mail.abc.com)
The following is the source code snippet. Please review it.
using CDO;
using Message = CDO.Message;
Message oMsg = new Message();
oMsg.From = SendEmailAddress;
oMsg.To = userEmail;
oMsg.Subject = "Prospect Reminder";
oMsg.HTMLBody = EmailContent.ToString();
oMsg.TextBody = EmailContent.ToString();
oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value
= 1;
oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value
= SendEmailAddress; //sender mail
oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value
= SendAccountName; //email account
oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value
= SendUserName;
oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value
= SendPassWord;
oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value
= SendAuthentication;
//value=0 Anonymous
//value=1 Basic(basic (clear-text) authentication.
//The configuration sendusername/sendpassword or
postusername/postpassword fields are used to specify credentials.)
//Value=2 NTLM(Secure Password Authentication in Microsoft Outlook
Express)
oFields["http://schemas.microsoft.com/cdo/configuration/languagecode"].Value
= 0x0804;
oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value
= SmtpServer;
oFields.Update();
oMsg.Send();
oMsg = null;
So, Can you give me any suggestion about this issue?
Best Regards,
Benny Ng
|
|
|
|
|
I downloaded an excellent cls from CP. Its a Task Scheduler[^]. Its an exceelnt class too. Its seems pretty popular considering the numbr of views so I'm sure one of you must be having an answer to my problem. Could someonel tell me how to modify a trigger of a task after the task has been saved. This is the only code snippet i could find:
ScheduledTasks st = new ScheduledTasks();<br />
<br />
Task task = st.OpenTask("D checker");<br />
<br />
if (task != null) {<br />
foreach (Trigger tr in task.Triggers) {<br />
if (tr is StartableTrigger) {<br />
(tr as StartableTrigger).StartHour = 4;<br />
(tr as StartableTrigger).StartMinute = 15;<br />
}<br />
}<br />
task.Save();<br />
task.Close();<br />
}<br />
st.Dispose();
But this code doesnt let me change the other properties of a trigger. How do i do that?
|
|
|
|