| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦   
共有 274 人关注过本帖
标题:急需,为什么老有未设置变量的错误啊
收藏  订阅  推荐  打印
wakfd209
Rank: 1
等级:新手上路
帖子:2
积分:120
注册:2005-6-25
急需,为什么老有未设置变量的错误啊

Option Explicit Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long Public OK As Boolean Dim txtSQL As String Dim mrc As ADODB.Recordset Dim MsgText As String Dim miCount As Integer

Private Sub Form_Load() Dim i As Integer i = 0 txtSQL = "select * from user_Form" Set mrc = ExecuteSQL(txtSQL, MsgText) With txtUserName Do While Not mrc.EOF i = i + 1 .AddItem Trim(mrc!user_ID) mrc.MoveNext Loop .ListIndex = i - 1 End With mrc.Close OK = False miCount = 0 End Sub

Private Sub cmdCancel_Click() OK = False Me.Hide End Sub

Private Sub cmdOK_Click() txtSQL = "select * from user_Form where user_ID = '" & txtUserName.Text & "'" Set mrc = ExecuteSQL(txtSQL, MsgText) If mrc.EOF = True Then MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告" txtUserName.SetFocus Else If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then OK = True mrc.Close Me.Hide UserName = Trim(txtUserName.Text) Else MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告" txtPassword.SetFocus txtPassword.Text = "" End If End If miCount = miCount + 1 If miCount = 3 Then Me.Hide End If Exit Sub End Sub

Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer) EnterToTab KeyCode End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call cmdOK_Click End If End Sub

Private Sub txtUserName_Click() txtPassword.Text = "" End Sub

Private Sub txtUserName_KeyDown(KeyCode As Integer, Shift As Integer) EnterToTab KeyCode End Sub 再以上这段代码中,老有未设置变量的错误,请高手指教,具体该怎么改啊

2005-6-25 19:36
heihei2000
Rank: 1
等级:新手上路
帖子:7
积分:170
注册:2005-3-6

里面有变量是函数名!
2005-6-26 19:47
共有 273 人关注过本帖
发新话题
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.047320 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved