| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1027 人关注过本帖
标题:编译下面代码时出现,缺少:标示符警告
只看楼主 加入收藏
yigererenren
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2017-3-8
结帖率:0
收藏
 问题点数:0 回复次数:2 
编译下面代码时出现,缺少:标示符警告
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
As Long
Public Const CB_FINDSTRING = &H14C

Private Sub Combo1_Change()
Dim iStart As Integer
Dim sString As String
Static iLeftOff As Integer
iStart = 1
iStart = Combo1.SelStart
If iLeftOff <> 0 Then
Combo1.SelStart = iLeftOff
iStart = iLeftOff
End If
sString = CStr(Left(Combo1.Text, iStart))
Combo1.ListIndex = SendMessage(Combo1.hwnd,B_FINDSTRING, -1, ByVal CStr(
Left( ombo1.Text, iStart))

 
If Combo1.ListIndex = -1 Then
iLeftOff = Len(sString)
Combo1.Text = sString
End If
Combo1.SelStart = iStart
iLeftOff = 0
End Sub
2017-03-09 13:04
ZHRXJR
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:125
帖 子:1034
专家分:5519
注 册:2016-5-10
收藏
得分:0 
程序代码:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) _
As Long
Private Const CB_FINDSTRING = &H14C

Private Sub Combo1_Change()
Dim iStart As Integer
Dim sString As String
Static iLeftOff As Integer
iStart = 1
iStart = Combo1.SelStart
If iLeftOff <> 0 Then
Combo1.SelStart = iLeftOff
iStart = iLeftOff
End If
sString = CStr(Left(Combo1.Text, iStart))
Combo1.ListIndex = SendMessage(Combo1.hwnd, B_FINDSTRING, -1, ByVal CStr( _
Left(ombo1.Text, iStart)))

 
If Combo1.ListIndex = -1 Then
iLeftOff = Len(sString)
Combo1.Text = sString
End If
Combo1.SelStart = iStart
iLeftOff = 0
End Sub

1、一条语句要分二行或多行,在分行的末尾加一个空格 + 一个英文下划线,不然程序按多行语句处理,二产生错误。
2、Public Const CB_FINDSTRING = &H14C 定义 Const 的关键字不是 Public 而是 Private
3、Combo1.ListIndex = SendMessage(Combo1.hwnd,B_FINDSTRING, -1, ByVal CStr( _
Left( ombo1.Text, iStart)) 语句少一个 ) 号。
给你修改的语句的语法应该没有错误了。

请不要选我!!!
2017-03-09 13:20
yigererenren
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2017-3-8
收藏
得分:0 
回复 2楼 ZHRXJR
谢谢

2017-03-10 09:33
快速回复:编译下面代码时出现,缺少:标示符警告
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032351 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved