Hi, For security for my program i get the HD #. After i get that i need to display it in a text box. I know how to do every thing ecept how to make the variable(HD#) appear in the text box with out pressing a buttun. As u can see the HD# is added to the text box with the event of a button click but i need to know how to put it all in into one thing without pressing a button.(Add the HD# to the text box with out pressing a button) Thanks


VB Code:
  1. Function GetSerialNumber(ByRef strDrive As String) As Integer
  2.         Dim SerialNum As Integer
  3.         Dim Res As Integer
  4.         Dim Temp1 As String
  5.         Dim Temp2 As String
  6.         '
  7.         Temp1 = New String(Chr(0), 255)
  8.         Temp2 = New String(Chr(0), 255)
  9.         Res = GetVolumeInformation(strDrive, Temp1, Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
  10.         GetSerialNumber = SerialNum
  11.  
  12.     End Function
  13.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  14.  
  15.         hi = "" & GetSerialNumber("C:\")
  16.        
  17.         TextBox2.Text = (hi)
  18.  
  19.     End Sub