Re: How do I get the user name in my VB.NET program?
From: Tom Shelton (tom_at_YOUKNOWTHEDRILLmtogden.com)
Date: 09/29/04
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: when is threading better than a timer?"
- Previous message: KC: "Re: CreateObject("Excel.Application",MyServer)"
- In reply to: Cor Ligthert: "Re: How do I get the user name in my VB.NET program?"
- Next in thread: Cor Ligthert: "Re: How do I get the user name in my VB.NET program?"
- Reply: Cor Ligthert: "Re: How do I get the user name in my VB.NET program?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Sep 2004 08:40:40 -0700
In article <uUEF51ipEHA.3724@TK2MSFTNGP10.phx.gbl>, Cor Ligthert wrote:
> Lanem,
>
> You can use WMI, however in my opinion is this snippet simpler for your
> question using the Environment variable
>
> \\\\needs 1 listbox on a form
> Dim environmentVariables As IDictionary _
> = Environment.GetEnvironmentVariables()
> Dim de As DictionaryEntry
> ListBox1.Items.Clear()
> For Each de In environmentVariables
> Me.ListBox1.Items.Add(de.Key.ToString & _
> "=" & de.Value.ToString)
> Next de
> ////
> You see that a list from things in de.Key and de.Value. One of them is
> username, however it is more interesting to look to all so I did not select
> that.
>
> Cor
>
>
Cor... Why not just use System.Environment.UserName?
Console.WriteLine (Environment.UserName)
-- Tom Shelton [MVP]
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: when is threading better than a timer?"
- Previous message: KC: "Re: CreateObject("Excel.Application",MyServer)"
- In reply to: Cor Ligthert: "Re: How do I get the user name in my VB.NET program?"
- Next in thread: Cor Ligthert: "Re: How do I get the user name in my VB.NET program?"
- Reply: Cor Ligthert: "Re: How do I get the user name in my VB.NET program?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|