none
How to find current user?

    Question

  • Hi, I am trying to make a zip/ folder bulk maker and give the program away, but I need a way to for the program to find the current user logged into place the Desktop.
    Sunday, April 23, 2017 12:43 PM

Answers

All replies

  • environment.username

    Success
    Cor

    • Proposed as answer by Devon_Nullman Monday, April 24, 2017 12:08 AM
    Sunday, April 23, 2017 1:07 PM
  • I am getting a error with that line.
    Monday, May 01, 2017 10:56 AM
  • I am getting a error with that line.

    This worked for me

    Dim user As String = Environment.UserName


    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it." - MSDN User JohnWein    Multics - An OS ahead of its time.

    Monday, May 01, 2017 11:14 AM
  • I am getting a error with that line.

    Try it like this and tell me what you see when you hover your mouse over "userName" please?

    Option Strict On
    Option Explicit On
    Option Infer Off
    
    Public Class Form1
        Private Sub Form1_Load(sender As System.Object, _
                               e As System.EventArgs) _
                               Handles MyBase.Load
    
            Dim userName As String = Environment.UserName
    
            Stop
    
        End Sub
    End Class


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Monday, May 01, 2017 11:15 AM
  • An error with that is in fact only possible if you have removed all references. If I do that as well and full qualify it, then I still get the name. 


    Success
    Cor


    Monday, May 01, 2017 7:04 PM