Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共9 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:这段注册的代码为何不成功?

1楼
yangming 发表于:2009/5/31 10:27:00
我在窗口中试了,
d =c  ,Code = b,但是,为何在代码中就是不成功呢?

Dim a,b,c,d,Code As String
Dim Val1 As String = e.Form.Controls("TextBox1").Value = ComputerId
a = StrReverse(Val1)
b = Left(a,8)
c =b & "yw"
Dim Val2 As String = EncryptText(c,"abc","123") '加密
    e.Form.Controls("TextBox2").Value = Val2
d = DecryptText(Val2,"abc","123")
Code = Left(d,8)
If d = c AndAlso Code = b Then
    MessageBox.Show("注册码成功!", "提示")
    e.Form.Close()
Else
    MessageBox.Show("注册码不正确!", "提示")
End If
[此贴子已经被作者于2009-5-31 10:27:04编辑过]
2楼
八婺 发表于:2009/5/31 12:23:00
偶还没学哟图片点击可在新窗口打开查看
3楼
yangming 发表于:2009/5/31 12:24:00
以下是引用八婺在2009-5-31 12:23:00的发言:
偶还没学哟图片点击可在新窗口打开查看

快快学啊,呵呵

4楼
狐狸爸爸 发表于:2009/5/31 13:08:00
可以用用Messagebox显示一下各个关键变量的值,大概就可以知道怎么回事的:

Dim a,b,c,d,Code As String
Dim Val1 As String = e.Form.Controls("TextBox1").Value = ComputerId
a = StrReverse(Val1)
b = Left(a,8)
c =b & "yw"
Dim Val2 As String = EncryptText(c,"abc","123") '加密
    e.Form.Controls("TextBox2").Value = Val2
d = DecryptText(Val2,"abc","123")
Code = Left(d,8)
messagebox.show(a & "|" &  b & "|" &  C & "|" &  Code)
If a=b AndAlso Code = c Then
    MessageBox.Show("注册码成功!", "提示")
    e.Form.Close()
Else
    MessageBox.Show("注册码不正确!", "提示")
End If
5楼
狐狸爸爸 发表于:2009/5/31 13:11:00
还有这一行也错了吧?

Dim Val1 As String = e.Form.Controls("TextBox1").Value = ComputerId
6楼
yangming 发表于:2009/5/31 13:11:00
我试试,呵呵
这里我就不明白a和b怎么会相等呢?
[此贴子已经被作者于2009-5-31 13:26:28编辑过]
7楼
狐狸爸爸 发表于:2009/5/31 15:16:00
问题出在这里:
Dim Val1 As String = e.Form.Controls("TextBox1").Value = ComputerId

val1的值不是computerid
而是true

8楼
yangming 发表于:2009/5/31 15:24:00
以下是引用狐狸爸爸在2009-5-31 15:16:00的发言:
问题出在这里:
Dim Val1 As String = e.Form.Controls("TextBox1").Value = ComputerId

val1的值不是computerid
而是true

怪不行我在窗口上试的时候是对的,在窗口我的这段代码是改成这样的
Dim Val1 As String =  ComputerId

9楼
yangming 发表于:2009/5/31 15:35:00
这样改了一下,成功了,呵呵,谢谢
Dim a,b,c,d,Code As String
Dim Val1 As String = e.Form.Controls("TextBox1").Value
a = StrReverse(Val1)
b = Left(a,8)
c =b & "yw"
Dim Val2 As String = EncryptText(c,"abc","123") '加密
    e.Form.Controls("TextBox2").Value = Val2
d = DecryptText(Val2,"abc","123")
Code = Left(d,8)
messagebox.show("a:" & a & "|" & "b:" &  b & "| C:" &  C & "|code:" &  Code)
If c =Left(a,8)& "yw" AndAlso Code = b Then
    MessageBox.Show("注册码成功!", "提示")
    e.Form.Close()
Else
    MessageBox.Show("注册码不正确!", "提示")
End If
共9 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02734 s, 2 queries.