Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Pulling the users login name into VB.net

Pulling the users login name into VB.net

Scheduled Pinned Locked Moved Visual Basic
questioncsharphelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    code_gopher
    wrote on last edited by
    #1

    How do I get the users login name and pull it into VB? THanks in advance for your help

    D 1 Reply Last reply
    0
    • C code_gopher

      How do I get the users login name and pull it into VB? THanks in advance for your help

      D Offline
      D Offline
      dynamic
      wrote on last edited by
      #2

      you mean this : VB:


      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim id As String = System.Environment.UserName & Chr(10) & System.Environment.UserDomainName
      MessageBox.Show(id)
      End Sub


      hope that helps, you can also do this : Imports System.Security.Principal <<< at top of form , then this : VB:


      Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
      Dim wp As WindowsPrincipal
      wp = New WindowsPrincipal(WindowsIdentity.GetCurrent())

          MsgBox(wp.Identity.Name.ToString)
      
      End Sub
      

      :)


      Private void ExpectingTwins(string twins)
      {
      switch(twins)
      {
      Case ("twins on the way"):
      MessageBox.Show("for mr and mrs dynamic","twins on the way");
      break;
      }
      }


      C 1 Reply Last reply
      0
      • D dynamic

        you mean this : VB:


        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim id As String = System.Environment.UserName & Chr(10) & System.Environment.UserDomainName
        MessageBox.Show(id)
        End Sub


        hope that helps, you can also do this : Imports System.Security.Principal <<< at top of form , then this : VB:


        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim wp As WindowsPrincipal
        wp = New WindowsPrincipal(WindowsIdentity.GetCurrent())

            MsgBox(wp.Identity.Name.ToString)
        
        End Sub
        

        :)


        Private void ExpectingTwins(string twins)
        {
        switch(twins)
        {
        Case ("twins on the way"):
        MessageBox.Show("for mr and mrs dynamic","twins on the way");
        break;
        }
        }


        C Offline
        C Offline
        code_gopher
        wrote on last edited by
        #3

        thanks..thats exactly what i needed

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups