By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,138 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

Get user name

P: n/a
Is there a simple way to get the current system user name?

Thanks for the information.

Brad
Nov 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Hi,

Environment.UserName or SystemInformation.UserName

Ken
-------------------
"Brad Allison" <ba******@ukcdogs.com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
Is there a simple way to get the current system user name?

Thanks for the information.

Brad

Nov 20 '05 #2

P: n/a
Got it, thanks. Now my next question is the username that is returned is
ComputerName/UserID. All I need is the user id. How would I take that
string and just get the last three characters?

I know this sounds like a simple question, but I do not have a lot of work
with strings.

Thanks for the info.

Brad

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:O2**************@TK2MSFTNGP10.phx.gbl...
Hi,

Environment.UserName or SystemInformation.UserName

Ken
-------------------
"Brad Allison" <ba******@ukcdogs.com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
Is there a simple way to get the current system user name?

Thanks for the information.

Brad

Nov 20 '05 #3

P: n/a
Got it! (Just the user name). I switched from SystemInformation to
Environment and it is returning just the username.

Thanks again.

Brad

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:O2**************@TK2MSFTNGP10.phx.gbl...
Hi,

Environment.UserName or SystemInformation.UserName

Ken
-------------------
"Brad Allison" <ba******@ukcdogs.com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
Is there a simple way to get the current system user name?

Thanks for the information.

Brad

Nov 20 '05 #4

P: n/a
Hi,

Try something like this.
Dim strUser As String =
Environment.UserName.Substring(Environment.UserNam e.IndexOf("/") + 1)

Ken

----------------------

"Brad Allison" <ba******@ukcdogs.com> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl...
Got it, thanks. Now my next question is the username that is returned is
ComputerName/UserID. All I need is the user id. How would I take that
string and just get the last three characters?

I know this sounds like a simple question, but I do not have a lot of work
with strings.

Thanks for the info.

Brad

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:O2**************@TK2MSFTNGP10.phx.gbl...
Hi,

Environment.UserName or SystemInformation.UserName

Ken
-------------------
"Brad Allison" <ba******@ukcdogs.com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
Is there a simple way to get the current system user name?

Thanks for the information.

Brad


Nov 20 '05 #5

P: n/a
Hi Ken,

I thought that I had seen you given this solution at least more than 3 times
in the last 3 days. (Very popular problem)

Nothing wrong with I was smiling and did want to tell you.

Cor
Nov 20 '05 #6

P: n/a
* "Brad Allison" <ba******@ukcdogs.com> scripsit:
Is there a simple way to get the current system user name?


'SystemInformation.UserName'
'Environment.UserName'
'WindowsPrincipal.Identity'

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #7

P: n/a
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Hi Ken,

I thought that I had seen you given this solution at least more than 3 times in the last 3 days. (Very popular problem)

Nothing wrong with I was smiling and did want to tell you.


He may not be seeing it. I've been seeing (or NOT seeing) all kinds of weird
stuff including missing posts lately. I'm not the only one and others on
other NG's have mentioned it lately also.
Nov 20 '05 #8

P: n/a
Hi,

Noticed that too.

Ken
----------------
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Hi Ken,

I thought that I had seen you given this solution at least more than 3 times
in the last 3 days. (Very popular problem)

Nothing wrong with I was smiling and did want to tell you.

Cor

Nov 20 '05 #9

P: n/a
Hi,

Most of the messages outlook express has reported as missing are
spam messages deleted by microsoft. Ocassionally I have had problems with
outlook express and have had to reset the account. Right click on the
newsgroup and select properties. Press the reset button in the local file
tab.

Ken
-----------------
"Ricky W. Hunt" <rh*****@hotmail.com> wrote in message
news:JabMc.169780$XM6.92728@attbi_s53...
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Hi Ken,

I thought that I had seen you given this solution at least more than 3 times in the last 3 days. (Very popular problem)

Nothing wrong with I was smiling and did want to tell you.


He may not be seeing it. I've been seeing (or NOT seeing) all kinds of weird
stuff including missing posts lately. I'm not the only one and others on
other NG's have mentioned it lately also.

Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.