请教如何才能让combobox的数据项全部清空。急急!!!

gbz 2003-06-16 02:11:29
请给出实例。。。
...全文
928 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
longji 2003-06-25
  • 打赏
  • 举报
回复
ComboBox1.Text=""也可以!
zfzfzf 2003-06-21
  • 打赏
  • 举报
回复
ComboBox1.clear
gbz 2003-06-19
  • 打赏
  • 举报
回复
老大我要的是简单的清空数据项(列表项)就行了,不明白!
longji 2003-06-16
  • 打赏
  • 举报
回复
组合框控件、AddItem 方法、Picture 和 PicturePosition 属性示例

下例用组合框来显示控件的图片位置选项。每次用户单击列表选项,命令按钮上的图片和题注都将被更新。这个代码示例还使用了 AddItem 方法来固定组合框选项。

若要使用该示例,请将示例代码复制到某窗体的声明变量部分。请确保该窗体包含:

名为 Label1 的标签。


名为 CommandButton1 的命令按钮。


名为 ComboBox1 的组合框。
Private Sub UserForm_Initialize()
Label1.Left = 18
Label1.Top = 12
Label1.Height = 12
Label1.Width = 190
Label1.Caption = "Select picture placement " _
& "relative to the caption."

'把列表条目加入组合框。每一
'条目的值符合组合框中
'对应的 ListIndex 的值。
ComboBox1.AddItem "Left Top" 'ListIndex = 0
ComboBox1.AddItem "Left Center" 'ListIndex = 1
ComboBox1.AddItem "Left Bottom" 'ListIndex = 2
ComboBox1.AddItem "Right Top" 'ListIndex = 3
ComboBox1.AddItem "Right Center" 'ListIndex = 4
ComboBox1.AddItem "Right Bottom" 'ListIndex = 5
ComboBox1.AddItem "Above Left" 'ListIndex = 6
ComboBox1.AddItem "Above Center" 'ListIndex = 7
ComboBox1.AddItem "Above Right" 'ListIndex = 8
ComboBox1.AddItem "Below Left" 'ListIndex = 9
ComboBox1.AddItem "Below Center" 'ListIndex = 10
ComboBox1.AddItem "Below Right" 'ListIndex = 11
ComboBox1.AddItem "Centered" 'ListIndex = 12
'使用下拉列表
ComboBox1.Style = fmStyleDropDownList '组合框值是 ListIndex 值
ComboBox1.BoundColumn = 0
'把组合框设置为第一个条目
ComboBox1.ListIndex = 0


ComboBox1.Left = 18
ComboBox1.Top = 36
ComboBox1.Width = 90
ComboBox1.ListWidth = 90

'初始化 CommandButton1
CommandButton1.Left = 230
CommandButton1.Top = 36
CommandButton1.Height = 120
CommandButton1.Width = 120

'注意:确认引用的位图文件是
'存在于系统中的,并在
'文件名中包括路径
CommandButton1.Picture = _
LoadPicture("c:\windows\argyle.bmp")
CommandButton1.PicturePosition = ComboBox1.Value
End Sub

Private Sub ComboBox1_Click()
Select Case ComboBox1.Value
Case 0 '上左
CommandButton1.Caption = "Left Top"
CommandButton1.PicturePosition = _
fmPicturePositionLeftTop

Case 1 '中左
CommandButton1.Caption = "Left Center"
CommandButton1.PicturePosition = _
fmPicturePositionLeftCenter

Case 2 '下左
CommandButton1.Caption = "Left Bottom"
CommandButton1.PicturePosition = _
fmPicturePositionLeftBottom

Case 3 '上右
CommandButton1.Caption = "Right Top"
CommandButton1.PicturePosition = _
fmPicturePositionRightTop

Case 4 '中右
CommandButton1.Caption = "Right Center"
CommandButton1.PicturePosition = _
fmPicturePositionRightCenter

Case 5 '下右
CommandButton1.Caption = "Right Bottom"
CommandButton1.PicturePosition = _
fmPicturePositionRightBottom

Case 6 '左上
CommandButton1.Caption = "Above Left"
CommandButton1.PicturePosition = _
fmPicturePositionAboveLeft

Case 7 '中上
CommandButton1.Caption = "Above Center"
CommandButton1.PicturePosition = _
fmPicturePositionAboveCenter

Case 8 '右上
CommandButton1.Caption = "Above Right"
CommandButton1.PicturePosition = _
fmPicturePositionAboveRight

Case 9 '左下
CommandButton1.Caption = "Below Left"
CommandButton1.PicturePosition = _
fmPicturePositionBelowLeft

Case 10 '中下
CommandButton1.Caption = "Below Center"
CommandButton1.PicturePosition = _
fmPicturePositionBelowCenter

Case 11 '右下
CommandButton1.Caption = "Below Right"
CommandButton1.PicturePosition = _
fmPicturePositionBelowRight

Case 12 '中
CommandButton1.Caption = "Centered"
CommandButton1.PicturePosition = _
fmPicturePositionCenter

End Select

End Sub
例行更新,不过本次有新组件加入,感觉这次的组件早就应该有了,居然到现在才加入进来,不管怎么说有总比没有好。这次还是以改进为主,改进项占了大多数。废话不多说具体内容大家看更新说明吧!另外由于经常收到chm格式文件无法用的反馈,其实不是无法用,只是要授权。虽然已经解释多遍,但是依然有人不知道,索性就取消chm格式的文档了,今后统一采用exe+pdf格式,由于目前尚无时间制作pdf格式的api文档,所以1.5版中只有exe的,pdf格式将在下一版中提供。 jQuery EasyUI 1.5版本更新内容: Bug(修复) combobox:修复在加载包含所选项数据的时候不会触发“onSelect”事件的BUG; datagrid:修复在字段设置为一个空值的时候导致在某些情况下“updateRow”方法无法正常工作的BUG。 Improvement(改进) 一个label标签可以被关联到任意表单的字段上; combobox:改进在下拉项中“select”和“unselect”的规则; combobox:添加“limitToList”属性来限制只能输入在列表项中的内容; combogrid:允许用户快速克隆组件; form:添加“dirty”属性,允许用户只发送变更的字段内容; form:添加“resetDirty”方法; datagrid:允许用户在没有数据的时候显示一条消息(比如:无记录); textbox:添加“label”、“labelWidth”、“labelPosition”和“labelAlign”属性; spinner:添加“spinAlign”属性; calendar:允许用户在日历组件上显示周数(今年的第几周); window:添加“constrain”属性。 New Plugin(新组件) passwordbox:该插件允许用户在具有更好交互功能的输入框中输入密码; combotreegrid:该插件结合了combobox和treegrid组件。
最近比较忙,抽空做了最新版的API,本次的主要精力就是放在了pdf版的文档上面,看了上一版好多人反应说希望保留chm格式的,所以这一版继续提供chm格式的文档给大家了,现在的版本中包含了PDF、EXE和CHM 3种格式的文档,相信应该可以满足大家的需要了。此外我个人推荐大家使用PDF格式的文档,因为PDF是全新制作的,内容进行了完整校对,所以错漏的地方比EXE和CHM格式要少很多。其它废话就不多说了。更新内容自己看更新说明吧! jQuery EasyUI 1.5.1版本更新内容: Bug(修复) datagrid:修复在调用“updateRow”方法之后选中和复选行标志丢失的问题; tabs:修复在调用“update”方法的时候导致标签栏工具错位的问题; window:修复在窗体高度设置为“auto”时,当移动窗体后窗体会丢失的问题; messager:修复在现实进度消息窗口后立即关闭该窗口会导致程序发生异常的问题; form:修复“clear”方法无法清除combobox组件选择的下拉项的问题。 Improvement(改进) textbox:可以用“cls”属性添加自定义样式; numberbox:允许用户使用意大利货币格式; combo:添加“multivalue”属性,允许用户决定如何提交多个值; combobox:添加“reversed”属性; combobox:添加“onClick”事件; combogrid:添加“reversed”属性; treegrid:使用Shift键启用多值选择。 New Plugin(新组件) tagbox:允许用户在表单字段上添加标签。

5,139

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧