还有一个vb问题

求助:下面的运行出来,提示:编译错误:在end sub,end function,或end属性后只能出现注释。

这是为什么啊?望高人指点啊.

Private Sub Form_Load()
Dim machine As String
Dim machine_decode As String
Dim txtsql As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
machine = GetSerialNumber("c:")
machine_decode = getserial()
Text1.Text = machine
txtsql = "select * from userenroll_info where machine = '" & machine & "' and decode='" & machine_decode & "'"
Set mrc = ExecuteSQL(txtsql,msgtext)
If mrc.EOF Then
MsgBox "没有注册信息!"
cmdok.Visible = False
cmdenroll.Visible = True
Else
MsgBox "找到注册信息"
cmdok.Visible = True
cmdenroll.Visible = False
Label2.Visible = False
Label3.Visible = False
Text1.Visible = False
Text2.Visible = False
End If
Set mrc = Nothing
End Sub
Private Sub cmdok_click()
Unload Me
frmmain.Show
End Sub
Private Sub cmdcancel_click()
End
End Sub
Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255,Chr$(0))
Temp2 = String$(255,Chr$(0))
Res = GetVolumeInfomation(strDrive,Temp1,Len(Temp1),SerialNum,Temp2,Len(Temp2))
GetSerialNumber = SerialNum
End Function

Function getserial() As String
Dim inputserial As String
Dim n As String
Dim n1 As String
Dim n2 As String
Dim p As Long
Dim p1 As Long
Dim p2 As Long
Dim i As Long
p = 0
p1 = 0
p2 = 0
n = ""
n1 = ""
n2 = ""
n = Str(GetSerialNumber("c:"))
n1 = ""
n2 = ""
If Len(n) < 20 Then
n = n + String(20 - Len(n),"z")
n1 = n1 + String(20 - Len(n),"A")
n2 = n2 + String(20 - Len(n2),"H")
End If
For i = 1 To 20
p = p + Asc(Mid(n,i,1)) * 199
p1 = p1 + Asc(Mid(n1,1)) * 179
p2 = p2 + Asc(Mid(n2,1)) * 109
Next
inputseial = Format(p) + "-" + Format(p1) + "-" + Format(p2)
getserialn = inputseial
End Function
Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String,ByVal lpVolumeNameBuffer As String,ByVal nVolumeNameSize As Long,lpVolumeSerialNumber As Long,lpMaximumComponentLength As Long,lpFileSystemFlags As Long,ByVal lpFileSystemNameBuffer As String,ByVal nFileSystemNameSize As Long) As Long

Private Sub cmdenroll_Click() Dim txtsql As String Dim mrc As ADODB.Recordset Dim msdtext As String If Len(Text2.Text) <> 20 Then MsgBox "您输入的注册码错误!" Exit Sub If Text2.Text <> getsrialn() Then MsgBox "注册码错误,请重新输入!" Exit Sub End If On Error GoTo err1 txtsql = "INSERT INTO userenroll_info(machine,decode) values('" & Text1.Text & "','" & Text2.Text & "')" Set mrc = ExecuteSQL(txtsql,msgtext) MsgBox "注册成功!" cmdok.Visible = True cmdenroll.Visible = False Label2.Visible = False Label3.Visible = False Text1.Visible = False Text2.Visible = False Exit Sub errl: MsgBox "添加注册信息失败!" End Sub

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...