|
-
Oct 9th, 2009, 04:59 PM
#1
Thread Starter
Frenzied Member
My.Computer.Name Property
Both of the below return the computers name in upper case even when the actual name is in lower case
Code:
MsgBox("Computer name: " & My.Computer.Name)
MsgBox(Environment.MachineName)
I have had a look in the help and on MSDN and could not find any explanation to confirm this.
Is this true for every windows version?
regards
toe
ps: i only use MsgBox when testing
-
Oct 9th, 2009, 05:22 PM
#2
Re: My.Computer.Name Property
A machine name is unique on the network and case-insensitive. So it should not matter what case it returns. You can always convert it to the one you want using any of the string functions.
e.g.
Code:
MsgBox(My.Computer.Name.ToLower)
MsgBox(My.Computer.Name.ToUpper)
-
Oct 9th, 2009, 05:34 PM
#3
Thread Starter
Frenzied Member
Re: My.Computer.Name Property
thanks fro the explanation.
The problem i came across was i was using the pc name as a registration key. [I know it isn't the most efficient way of doing it but that's all i am capable of at the moment]
On my 3 machines the pc names are in lower case so the program failed to start because the .net language was converting the pc name to upper case.
i just have to remember to change it to upper case
regards
toe
-
Oct 9th, 2009, 08:15 PM
#4
Re: My.Computer.Name Property
Why not just do a case-insensitive comparison? That way it doesn't matter what case is used where. The String.Equals method, among others, supports case-insensitive comparisons.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|