用vb编写代码,执行时出现了编译错误,是说“子程序或函数未定义”,帮帮忙看一哈
PrivateDeclareFunctionGetComputerNameLib"kernel32"Alias"GetComputerNameA"(ByVallpBuff...
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Timer.Interval = 1000
End Sub
Private Sub timer_Timer()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'获取本地计算机名并将其同赋给全局变量 myComputerName↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim name As String
name = String(225, " ")
Call GetComputerName(name, 225)
name = RTrim(name)
myComputerName = name
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'根据条件查找网络中的SQL服务器名并将其赋给 frmLand.cmbSName↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo err1
If GetSetting("yinhang", "yinhangBank", "IfSaveSvName") = 1 Then
frmland.CmbSName = GetSetting("yinhang", "yinhangBank", "SName")
Else
err1:
If getSNameList() = False Then
MsgBox "服务器名加载错误,请稍后自行指定", vbExclamation, "提示"
End If
End If
''''''''''''''''''''''''''''''''''''
Unload Me
frmland.Show
frmland.SetFocus
End Sub 展开
Private Sub Form_Load()
Timer.Interval = 1000
End Sub
Private Sub timer_Timer()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'获取本地计算机名并将其同赋给全局变量 myComputerName↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim name As String
name = String(225, " ")
Call GetComputerName(name, 225)
name = RTrim(name)
myComputerName = name
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'根据条件查找网络中的SQL服务器名并将其赋给 frmLand.cmbSName↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo err1
If GetSetting("yinhang", "yinhangBank", "IfSaveSvName") = 1 Then
frmland.CmbSName = GetSetting("yinhang", "yinhangBank", "SName")
Else
err1:
If getSNameList() = False Then
MsgBox "服务器名加载错误,请稍后自行指定", vbExclamation, "提示"
End If
End If
''''''''''''''''''''''''''''''''''''
Unload Me
frmland.Show
frmland.SetFocus
End Sub 展开
展开全部
'getSNameList没有声明 最前面加上这句:
Public Function getSNameList() As Boolean
'如下
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function getSNameList() As Boolean
End Function
Private Sub Form_Load()
Timer.Interval = 1000
End Sub
Private Sub timer_Timer()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'获取本地计算机名并将其同赋给全局变量 myComputerName↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim name As String
name = String(225, " ")
Call GetComputerName(name, 225)
name = RTrim(name)
myComputerName = name
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'根据条件查找网络中的SQL服务器名并将其赋给 frmLand.cmbSName↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo err1
If GetSetting("yinhang", "yinhangBank", "IfSaveSvName") = 1 Then
frmLand.cmbSName = GetSetting("yinhang", "yinhangBank", "SName")
Else
err1:
If getSNameList() = False Then
MsgBox "服务器名加载错误,请稍后自行指定", vbExclamation, "提示"
End If
End If
''''''''''''''''''''''''''''''''''''
Unload Me
frmLand.Show
frmLand.SetFocus
End Sub
Public Function getSNameList() As Boolean
'如下
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function getSNameList() As Boolean
End Function
Private Sub Form_Load()
Timer.Interval = 1000
End Sub
Private Sub timer_Timer()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'获取本地计算机名并将其同赋给全局变量 myComputerName↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim name As String
name = String(225, " ")
Call GetComputerName(name, 225)
name = RTrim(name)
myComputerName = name
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'根据条件查找网络中的SQL服务器名并将其赋给 frmLand.cmbSName↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo err1
If GetSetting("yinhang", "yinhangBank", "IfSaveSvName") = 1 Then
frmLand.cmbSName = GetSetting("yinhang", "yinhangBank", "SName")
Else
err1:
If getSNameList() = False Then
MsgBox "服务器名加载错误,请稍后自行指定", vbExclamation, "提示"
End If
End If
''''''''''''''''''''''''''''''''''''
Unload Me
frmLand.Show
frmLand.SetFocus
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你用我修改后的代码试试:
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Timer.Interval = 1000
End Sub
Private Sub timer_Timer()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'获取本地计算机名并将其同赋给全局变量 myComputerName↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim name As String
name = String(225, " ")
Call GetComputerName(name, 225)
name = RTrim(name)
myComputerName = name
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'根据条件查找网络中的SQL服务器名并将其赋给 frmLand.cmbSName↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo err1
If GetSetting("yinhang", "yinhangBank", "IfSaveSvName") = 1 Then
frmland.CmbSName = GetSetting("yinhang", "yinhangBank", "SName")
Else
err1:
If getSNameList = False Then
MsgBox "服务器名加载错误,请稍后自行指定", vbExclamation, "提示"
End If
End If
''''''''''''''''''''''''''''''''''''
Unload Me
frmland.Show
frmland.SetFocus
End Sub
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Timer.Interval = 1000
End Sub
Private Sub timer_Timer()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'获取本地计算机名并将其同赋给全局变量 myComputerName↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim name As String
name = String(225, " ")
Call GetComputerName(name, 225)
name = RTrim(name)
myComputerName = name
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'根据条件查找网络中的SQL服务器名并将其赋给 frmLand.cmbSName↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo err1
If GetSetting("yinhang", "yinhangBank", "IfSaveSvName") = 1 Then
frmland.CmbSName = GetSetting("yinhang", "yinhangBank", "SName")
Else
err1:
If getSNameList = False Then
MsgBox "服务器名加载错误,请稍后自行指定", vbExclamation, "提示"
End If
End If
''''''''''''''''''''''''''''''''''''
Unload Me
frmland.Show
frmland.SetFocus
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
getSNameList()这个函数没有定义,所以出错。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
“If getSNameList() = False Then”这行中的 getSNameList() 没有定义
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
GetSetting,GetSetting都没有定吧。
你要学会debug,单步跟踪一下,就可以发现问题所在了。开发人员debug排除问题是最基本技能
你要学会debug,单步跟踪一下,就可以发现问题所在了。开发人员debug排除问题是最基本技能
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询