(ACCESS数据库VB编程)菜鸟请教大虾中……
之前根本没有接触过VB,现特向各位大侠求助,看能不能帮我看看,VB不是那么简单,现在才刚刚开始接触。请问:怎么把类似这源代码做成能在Windows下独立运行的程序?备注:...
之前根本没有接触过VB,现特向各位大侠求助,看能不能帮我看看,VB不是那么简单,现在才刚刚开始接触。
请问:怎么把类似这 源代码 做成能在Windows下 独立运行的程序?
备注:本人不是在求作业答案!只是想问大家“方法”!
(ACCESS数据库VB编程)--源代码(例子) 如下:
----------------------------------
系统登录界面:
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 展开
请问:怎么把类似这 源代码 做成能在Windows下 独立运行的程序?
备注:本人不是在求作业答案!只是想问大家“方法”!
(ACCESS数据库VB编程)--源代码(例子) 如下:
----------------------------------
系统登录界面:
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 展开
4个回答
展开全部
复制、粘贴
文件-生成XXX.EXE文件
找到程序文件包,里面就有XXX.exe文件了,那就是可执行文件!
文件-生成XXX.EXE文件
找到程序文件包,里面就有XXX.exe文件了,那就是可执行文件!
追问
我有的全都像上面那样文本 的 源代码,没有工程文件/窗体文件 那些,我就是想问怎么 是这些文本 的代码 导入VB里,使它生成工程……
-----------------
你说的 文件==》生成XXX.EXE文件,这个我知道
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
上面代码不全 需要一定补充 还有画窗体什么的,你不会VB搞不定
追问
代码全给你,帮我搞定?酬谢
追答
最近在琢磨IMPACT X 2D引擎,对这些懒的管
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
编译可执行程序
更多追问追答
追问
问题是,我还不会把以上的代码 导入VB中啊!
求过程 截图 或 文字说明,如果可以,远程!
追答
这些代码只是文本吗?没有在工程里面写?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-05-23
展开全部
录制宏文件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询