Visual Basic Finding the Operating System Username

In Visual Basic, the UserName property of the Environment class is used to find the active user name in the current operating system.

An example is given below..

Module ModuleTest Sub Main() Dim uName As String = System.Environment.UserName Console.WriteLine(uName) Console.ReadLine() End Sub End Module


You May Interest

How to Find the Name of the Operating System in Visual Basic ?

Visual Basic Get Now

Visual Basic Non-Restart Check If Application is Open

Visual Basic Adding Elements to List

Visual Basic Powering a Number