|
|
Thanks. Slow day is it?
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
is there a way to get all the root paths of all the drives? like c:\ d:\ e:\ f:\ and so on..
|
|
|
|
|
WMI may help, but i dont know excatly how to do it. and there is probably a faster way, one of the guys here was using it to get the space used and space available on each drive on a system and remote server and it was kinda slow.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
string[] drives = Environment.GetLogicalDrives();
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello
Yes !
you can use WMI to get all connected drives
|
|
|
|
|
Of course you can ... alot of ways to do so and WMI is one of them ... use the System.Management namespace to help you so ... as follows:
ArrayList list = new ArrayList();
using (ManagementObjectSearcher DiskSearch = new ManagementObjectSearcher(new SelectQuery("Select * from Win32_LogicalDisk")))
{
using (ManagementObjectCollection moDiskCollection = DiskSearch.Get())
{
foreach (ManagementObject mo in moDiskCollection)
{
list.Add(mo["Name"].ToString ());
MessageBox.Show(mo["Name"].ToString());
mo.Dispose();
}
}
}
Dont forget to add a reference in your project to System.Management dll and you will get all the drives .. for more properties go to this link to get them (other than the Name property used here):
http://msdn.microsoft.com/en-us/library/aa394173.aspx[^]
Enjoy !
Note: If you found this answer useful please indicate that so other would know so.
Sincerely Samer Abu Rabie
Software Engineer
|
|
|
|
|
All,
thanks to led mike I have a new project template in my 'create project' part of VS2005. Opening it opens my wizard dialog and after some options I can start creating my custom solution.
My code however crashes on the AddFromTemplate method.
(EnvDTE.Project proj = MySolution.AddFromTemplate( ... ); )
it gives a HRESULT failed from the com interop error. I check my path and the example of MSDN and it looks OK.
My guess is that the project template I use is not really valid (exact copy of the standard windowsapplication project)
Can anyone help me with this?
MSDN[^] doesn't seem to explain what exactly you need to do...
thanks a lot (nearly there , maybe I can write an article about it in exchenge if I get it to work )
|
|
|
|
|
I have a string and I want to compare to another string, and if they are not equal I want my app to do something. How is the not equal statement in C#? Like for equal we have: if(string.Equals(anotherString)) do something. How should I declare if is not equal? Thx
|
|
|
|
|
|
|
I recommend if you really want to learn C#, you buy a book. You really need to have a reference for basic questions like this and not to have to rely on web forums.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: I recommend if you really want to learn C#, you buy a book. You really need to have a reference for basic questions like this and not to have to rely on web forums.
Why?? All the VB developers here (my office), have a terrible fear of Google and any form of documentation.
|
|
|
|
|
huh ?
|
|
|
|
|
leppie wrote: All the VB developers here (my office), have a terrible fear of Google and any form of documentation
I thought you'd have managed to hunt them all down and brand them by now.
|
|
|
|
|
Yes, but this is the C# forum.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Strictly speaking, string comparisons should be done using the special internationalized comparison operations such as string.Compare();[^].
|
|
|
|
|
Pete O'Hanlon wrote: Strictly speaking, string comparisons should be done using the special internationalized comparison operations such as string.Compare();[^].
Very strictly speaking you want to use CompareInfo.Compare for locale independent strings, eg case-insensitive compare of "strasse" and "Straße".
|
|
|
|
|
...guys, I didn't knew that such a simple question would gain such an attention
|
|
|
|
|
leppie wrote: Very strictly speaking you want to use CompareInfo.Compare for locale independent strings, eg case-insensitive compare of "strasse" and "Straße".
Well, I did link to String.Compare(String, String, CultureInfo, CompareOptions) .
|
|
|
|
|
Pete O'Hanlon wrote: Well, I did link to String.Compare(String, String, CultureInfo, CompareOptions).
That is not in my .NET! Which one are you using?
|
|
|
|
|
This member was introduced in .NET Framework 2.0 SP2, 3.0 SP2 and 3.5 SP1.
|
|
|
|
|
Pete O'Hanlon wrote: This member was introduced in .NET Framework 2.0 SP2, 3.0 SP2 and 3.5 SP1.
I do not have 3.5 SP1 (I assume this installs the other SP's too). And your original link does not work... Both IE and FF reports an error.
|
|
|
|
|
Refresh the page after the error. I just had this issue, and it refreshes it OK.
|
|
|
|
|
Urggg. Seems MSDN is down for me, tried some other links now, same result...
|
|
|
|