Results 1 to 2 of 2

Thread: Machine Name

  1. #1

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Machine Name

    I am trying to get the machine name of the computer that is running my application but i keep getting this error (it's on the line that is in bold):

    Object reference not set to an instance of an object.

    VB Code:
    1. Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         AxAnimation1.Open(Application.StartupPath & "\EARTH_SPIN.avi")
    3.         MachineName = Space$(64)
    4.         CompNameSize = Len(MachineName)
    5.         [B]Compname = GetComputerName(MachineName, CompNameSize)[/B]
    6.         Compname = Trim(MachineName)
    7.         Label1.Text = Compname
    8.     End Sub

    It looks like i needed to declare somethin....i think. Does anyone see a problem?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Environ("COMPUTERNAME")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width