|
Those settings are changed through the .config file for the application, which is located in the same directory as the application and with the same filename with ".config" appended.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello =)
Thanks for answering but I know they are in there, but you shouldn't have to change the values there with xml types. If you let VS make the settings class it creates a class called Settings that inherits from ApplicationSettingsBase. You can also make your own class and inherit from ApplicationSettingsBase, and then add a property for every setting.
Read more about this here:
http://msdn2.microsoft.com/library/0zszyc6e.aspx
~~~~~~~~~~~~~~
Martin Lundberg
Student, Sweden
I have to thank every member of the Code Project for making it such a great place for a beginner to learn!
|
|
|
|
|
Yes, I'm well aware of that.
VS 2005 is in beta, and there's a lot that doesn't work. We're nearing beta 2 when much more works but can release no further details about when beta 2 is due to release.
For now you have to change the settings through the .config file as you do for .NET 1.0 and 1.1 or write your own SettingsProvider which is responsible for serializing the ApplicationSettingsBase class (and its derivatives).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello again!
Well, I've tested some more and if I use user-scoped settings I am able to change them and save them.
=) Thanks for the answers!
~~~~~~~~~~~~~~
Martin Lundberg
Student, Sweden
I have to thank every member of the Code Project for making it such a great place for a beginner to learn!
|
|
|
|
|
I have tried the above solution .
but if i give File.AppendText(Path) then it will append it at the end
so what to do?
|
|
|
|
|
Try the following:
using (StreamWriter sw = File.AppendText(Path))
{
sw.BaseStream.Position = 1;
sw.WriteLine("Hello World");
}
www.troschuetz.de
|
|
|
|
|
I tried out the code but i got a runtime error at sw.BaseStream.Position=0;(It is zero based).
System.IO.IOException: Unable seek backward to overwrite data that previously existed in a file opened in Append mode.
what to do?
Sukanya
|
|
|
|
|
I took a deeper look into the documentation and think you'll have to use one of the other suggested solutions.
The File.AppendText(path) method is equivalent to StreamWriter(path, true) . The boolean parameter append "determines whether data is to be appended to the file. If the file exists and append is false, the file is overwritten. If the file exists and append is true, the data is appended to the file. Otherwise, a new file is created."
So in the current solution, append is true and seeking backward is forbidden. By replacing File.AppendText(path) with StreamWriter(path, false) you should be able to seek backward, but as the above text state the existing file content will be overwritten.
Sorry and more luck with the other suggestion
www.troschuetz.de
|
|
|
|
|
The word "Append" literally means "Add to the end" - so they have named this method correctly it seems.
With the lack of a "Prepend" method, you will need to use the above solution of setting position to zero and using Write or WriteLine
|
|
|
|
|
Hello gurus,
I would like to know how I can process the Key events in a dialog box?
I have controls (buttons, radio buttons etc.) in my dialog box and I have to process the Left/Right/Down/Space keys. The problem is that when I override the OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) method of the form, the focus of the controls in my form moves while I press the arrow keys... got it?
So, how can I avoid the process of the default behaviour of these keys?
In MFC a simple PreTranslateMessage was there, but in C#... how to to that???
Thanks for the help.
Best regards.
There is no spoon.
|
|
|
|
|
|
is there a simpler way?
There is no spoon.
|
|
|
|
|
If you need the form to process all key events for any controls, then set Form.KeyPreview to true .
While the other controls have focus and without KeyPreview being set the messages are handled only by the active control's message handler (WndProc in managed code).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
ah, ok it works.
now no matter the control I insert, the form handles the KeyDown event
thanks.
There is no spoon.
|
|
|
|
|
hi all,
I have an application, where there is a service manager which is responsible for controlling three services. The three services (which r controlled by service manager) have exe files. I have installed these three services using the installutil.exe . Now, i cannot install the service manager in the same way as I installed the three services because service installer is not present for the service manager application.
What i have to do now, Should i add installer to the service manager application and install it using installutil.exe....... if, so , how are the other three services controlled by this application.......
|
|
|
|
|
I'm not sure I fully understand your question. Is the service manager project, itself, a service? If it is, then yes, add an installer project for the service project, compile it and install it.
If, however, the service manager project is just a standard executable or a web project (doubtful), then it should be possible to compile and execute the manager from the windows desktop.
As to how the other three services are controlled by the manager, you would need to provice more implementation details about the service manager project for me to answer that question.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Just copy it to a directory. If the three services are installed the service manager application using the ServiceController doesn't need to be in the same directory as the services. The ServiceController (which encapsulates the service control manager (SCM) native APIs) works with service names and doesn't care about the path once the service is registered (and, BTW, all services are executables).
The service manager application will need to know the names of the services only. Where you put it on the local machine (and you can even control services remotely if you have the necessary privileges) doesn't matter.
Read Deploying Applications[^] in the .NET Framework SDK for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi.
I guess you all know about PE files' timestamps. The are in hex, and for example
41DE6BF7 means 07/01/2005 11:01:11.
I tried many ways to 'convert' the timestamp to a DateTime object, but they all failed. (DateTime.FromFileTime(...), FromTicks(...)
My question is, how to 'convert' the hex value to a DateTime.
Thanks in advance and best regards,
Stan
|
|
|
|
|
No, timestamps are not in hex. Hexadecimal is only a numeric representation. They're a number and that's all. To actually be stored in hex would require storing a string, which I know is now the case.
To convert numbers to a filetime, you can pass the number (a long , or Int64 ) to either of the static DateTime.FromFileTime or DateTime.FromFileTimeUtc methods. In your case, you'll want to use DateTime.FromFileTimeUtc since timestamps are specified in UTC (+0 GMT).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I am wondering how to develop an application with multi-language. What's the common practise for this? I don't think people will change every single word from English to other language. Any good approach for this?
Thanks,
Leo
|
|
|
|
|
luozhan1 wrote:
I don't think people will change every single word from English to other language.
That would really piss off people. Imagine if I am using an application like IE and I have a Menu called "Archivo" (Spanish for file) and then in that menu (because you couldn't be bother to change all the words) were "Open" and "Exit" instead of "Abrir" and "Cerrar". That would be confusing (especially as Exit is very similar to the Spanish word for "success")
luozhan1 wrote:
Any good approach for this?
You should read up on the subjects of Localisation, Globalisation and Internationalisation (you may need to replace my -sation with -zation as I am localised to UK-English and the documentation is in US-English)
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Colin Angus Mackay wrote:
That would really piss off people.
That's a good way of putting it. Here at Microsoft and other global companies geopolitical issues are a major concern. What you may not find offensive some other group of people may.
There are books on this issue. One that's required reading here is Developing International Software, Second Edition[^]. It's definitely worth a read if you're seriously planning on localizing your code.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
The SDK has a wealth of information on localisation (long live Australian English! ); in fact I just started reading up on the topic myself - I want to implement localisation into my ASP.NET applications for work.
The common approach (from what I have been reading) is to use satellite assemblies which are loaded dynamically depending on the user's current CultureInfo.CurrentUICulture setting. If a satellite assembly isn't available for their UI culture, use the default.
However, I don't know anything more than that - I haven't even got it working myself yet
This space for rent!
My Blog
|
|
|
|
|
|
Those are for ASP.NET. Assuming they did it the right way, Windows Forms applications are still localized a little differently.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|