|
Hi all,
i am not looking for something sophisticated but just to read the "Location" field that i insert in the computer's Regional Settings menus..(in Control Panel)
any ideas how to get it?
(i do not want to find out through the IP)
Thnaks,
R.Z
|
|
|
|
|
Hi
by using the following class
System.Threading.Thread.CurrentThread.CurrentUICulture
you can read the os globalization info,
it is like en-US, tr-TR ..
hope this helps you.
|
|
|
|
|
You can use RegionInfo.CurrentRegion.DisplayName . Don't forget to reference namespace System.Globalization .
Regards
|
|
|
|
|
Hello,
I'm working on a schoolproject for the school-radio and I need to have an option in my program to play and crossfade between 2 track's, does someone has an idea on how I should start with this or what I need to start. I also need to get de mp3-tags of the music I'm playing but that's no problem because there are some good articles about that on this site
Kind regards,
Frederik
|
|
|
|
|
Moh, wie dan we daar en...
Nee da wetek ook nie
Greetz.
|
|
|
|
|
Can you answer in English please...
|
|
|
|
|
Hi there! I'm not able to convert following vb.net code to c#. Pls assist
Public Sub WriteBinary(ByVal FileName As String, ByVal ds As DataSet)
ds.RemotingFormat = SerializationFormat.Binary
Dim myFormatter As IFormatter = New Formatters.Binary.BinaryFormatter
Dim myStream As Stream = New FileStream(FileName, FileMode.Create)
myFormatter.Serialize(myStream, ds)
End Sub
The line in bold is giving me trouble
Thanks
Don't Quit
|
|
|
|
|
IFormatter myFormatter = new Formatters.Binary.BinaryFormatter();
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Hi Guffa! Thanks for replying. I've already done this. It don't seem to work. This is the code.
void WriteBinary(String FileName, DataSet ds)
{
ds.RemotingFormat = SerializationFormat.Binary;
IFormatter myFormatter = new Formatters.Binary.BinaryFormatter();
Stream myStream = new FileStream(FileName, FileMode.Create);
myFormatter.Serialize(myFormatter, ds);
}
These are the errors
Error 1 The type or namespace name 'Formatters' could not be found (are you missing a using directive or an assembly reference?) d:\Nitin\Serialization1\Serialization1\Serialization1\Form1.cs 58 42 Serialization1
Error 2 The best overloaded method match for 'System.Runtime.Serialization.IFormatter.Serialize(System.IO.Stream, object)' has some invalid arguments d:\Nitin\Serialization1\Serialization1\Serialization1\Form1.cs 60 13 Serialization1
Error 3 Argument '1': cannot convert from 'System.Runtime.Serialization.IFormatter' to 'System.IO.Stream' d:\Nitin\Serialization1\Serialization1\Serialization1\Form1.cs 60 35 Serialization1
Thanks
Don't Quit
|
|
|
|
|
Nitin1981 wrote: Error 1 The type or namespace name 'Formatters' could not be found (are you missing a using directive or an assembly reference?
I see. Specifying namespaces works a bit different in VB and C#. Specify the full namespace:
IFormatter myFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
Nitin1981 wrote: Error 3 Argument '1': cannot convert from 'System.Runtime.Serialization.IFormatter' to 'System.IO.Stream'
Why have you put the formatter there? In the VB code it's the stream.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Hi Guffa, I got it to work. Ya I did make a mistake.
1. Even after importing necessary namespace fully qualified namespace has to be specified in c sharp so is it a bug in Csharp.?
2. Another thing how do you arrive at the conclusion by trial & error or is there some other way.
Thanks for your assistance.
Don't Quit
|
|
|
|
|
Nitin1981 wrote: 1. Even after importing necessary namespace fully qualified namespace has to be specified in c sharp so is it a bug in Csharp.?
No, it's not a bug. C# is just a little stricter about separating namespaces from class names than VB. When you import a namespace in C# you have to specify the complete namespace, while in VB you can import part of the namespace and specify the rest of the namespace in the code. If you specify the complete namespace, you can use the BinaryFormatter class name in the code without the namespace:
using System.Runtime.Serialization.Formatters.Binary;
Nitin1981 wrote: 2. Another thing how do you arrive at the conclusion by trial & error or is there some other way.
What conclusion?
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Hi I mean the difference between the syntax in c# and vb.net (for example in this case)
Thanks!
Don't Quit
|
|
|
|
|
You mean how I translate the code from VB to C#?
Basically I read the code and make sure that I understand what it does, then I write code that does the same thing. In .NET you have the advantage of the shared framework, which means that the classes used are the same and work the same.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
No I mean first (in your first reply of this question) you also guessed that code should be like this
IFormatter myFormatter = new Formatters.Binary.BinaryFormatter();
Which was also the case with me. But later you came to the conclusion we need to specify full path in c#.I think now I'm clear enough.
Thanks a lot
Don't Quit
|
|
|
|
|
Specifying the full namespace is a way that always work, regardless of what namespaces you have imported (provided of course that you have a reference to the dll containing the class). Once it works, you can start looking into writing the using statement that imports that specific namespace.
I don't develop anything in VB.NET, that's why I didn't remember the difference in how namespaces are used from the start.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Ok Got it! Thanks for your expert opinion and I will try to implement them myself.
Thanks once again
Don't Quit
|
|
|
|
|
Hi all,
How I can know that when my form is obscured by another window and name of that wimdow during run time?
Thanks,
Muharrem
|
|
|
|
|
Hello everybody,
I have to copy and delete a file by using a ftp path (ftp://xxx.xxx.x.x/mydirectory).
Is there a possibility in .Net1.1 without using a ftp-server?
Thank's for youre time!
Martin
|
|
|
|
|
There is no direct FTP functionality in .NET1.1. As this is simply socket programming, you can roll your own or use something like this:
http://www.codeproject.com/cs/internet/ftplib.asp[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
|
|
Hi All,
Can anyone please tell me hoe to set the value to a custom exception object?
If so, pls give a code snippet?
thanks in advance
Regards
babu
|
|
|
|
|
What value?
You can create an Exception object with any message you like:
new ApplicationException("Nu sket det sig rejält, må jag säga.")
You can also create specific Exception objects for different kinds of errors. Some examples:
new ArgumentNullException("path", "The path argument may not be null.")<br />
new NullReferenceException("The operation resulted in a null reference.")<br />
new IndexOutOfRangeException("The position has to be in the range 0 to 9.")<br />
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|