Quick easy Question

Vb Gangsta

Active member
Joined
Aug 31, 2003
Messages
27
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] 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[/code]
 
I suspect that I didnot understand the question well, but If you mean how to directly put it in the textbox without user intervention you can use the Form_Load Event and put the code you put in the button click there.

Hope this helps,
 
Back
Top