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:
Function GetSerialNumber(ByRef strDrive As String) As Integer Dim SerialNum As Integer Dim Res As Integer Dim Temp1 As String Dim Temp2 As String ' Temp1 = New String(Chr(0), 255) Temp2 = New String(Chr(0), 255) Res = GetVolumeInformation(strDrive, Temp1, Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2)) GetSerialNumber = SerialNum End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click hi = "" & GetSerialNumber("C:\") TextBox2.Text = (hi) End Sub




Reply With Quote