
正文
vb.net软件注册代码 vb控件注册
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb中注册代码怎么写,要求要测试成功!
最简单的一个是,在启动窗体中,加入一行代码:if inputbox("请输入注册码","注册",123") “123456” then end'这个是说,如果输入的不是123456,就退出程序,正确后就向下执行。如果要注册码与用户名相结合,则要先用用户名作为种子,进行加密操作,生成一个注册码,成一一对应关系就行了。如用户名为abc,代码如下:dim a as string,b as string,i as integer,k as integera=inputbox("请输入用户名","注册用户")for i = 1 to len(a)b=b str(asc(mid(a,i,1)))next ib=6 bif b-int(len(b)/2)*2 = 1 then b = b 4text1 = "用户名是:" aa=""for i = 1 to len(b) step 2if mid(b,i,2)32 then a=a str(mid(b,i,2)+32) else if mid(b,i,2) 126 then a=a str(mid(b,i,2)-32) else a=a str(mid(b,i,2)) end ifend if next itext1 = text1 " 注册码是: " a这样就可以了
相关问答
Q1: VB.Net程序中怎么注册OCX控件
参看下面的代码
Public Sub main()
Dim str As String = Application.StartupPath "\videocapx.ocx"
Shell("regsvr32.exe /s """ str """", AppWinStyle.NormalFocus)'这里如果文件名包含空格,需要把整个文件名用双引号引起来哦,切记
Application.Run(New Form1)
End Sub
Q2: vb.net怎么写注册代码
Private Sub 提交_Click()
Dim stemp As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
stemp = "select * from user"
rs.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Me!密码 确认密码 Then
MsgBox "两次输入vb.net软件注册代码的密码不一致vb.net软件注册代码,请重新输入", vbExclamation, "Error"
Exit Sub
Else
stemp = "insert into user"
stemp = stemp "(用户名vb.net软件注册代码,密码vb.net软件注册代码,身份证号)"
stemp = stemp " values('" Me!用户名 "','" Me!密码 "','" Me!身份证号 "')"
DoCmd.RunSQL stemp1
Set rs = Nothing
End If
MsgBox "The information of register have saved already!", vbExclamation, "information"
End Sub
Q3: VB.NET 注册代码
写两个函数vb.net软件注册代码,一个检测是否有重复用户,第二个插入
检测属用户是否存在
private function checkUser(byval uname as string) as boolean
dim sql as string = "select * from [user] where username=" uname
dim cmd as sqlcommand = new sqlcommand(sql,conn)
dim read as sqldatareader = cmd.excutereader
dim result as boolean = read.hasrows
cmd=nothing
return result
end function
新增用户
private sub adduser(byval uname as string,byval password as string)
if checkUser(uname)
messagebox.show("用户已存在")
exit sub
end if
try
dim sql as string = "insert into [user](username,password) values(@uname,@upass)"
dim cmd as sqlcommand = new sqlcommand(sql,conn)
cmd.parameters.add("@uname",sqldbtype.varchar).value=uname
cmd.parameters.add("@upass",sqldbtype.varchar).value=password
cmd.ExecuteNonQuery
cmd=nothing
messagebox.show("用户添加成功vb.net软件注册代码!")
catch ex As Exception
messagebox.show("用户添加失败vb.net软件注册代码!" + ex.message)
end try
end sub
Q4: vb.net 注册问题
改为:
sql = "insert into 表1 values(用户名='" TextBox1.Text "' ,密码='" TextBox2.Text "')"
vb.net软件注册代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb控件注册、vb.net软件注册代码的信息别忘了在本站进行查找喔。






