下拉列表框下拉时及关闭下拉时显示不同 text 的实现 (VS2010)

ccm1818168 2014-11-06 06:00:30
下拉列表框下拉时及关闭下拉时显示不同 text 的实现 (VS2010)

---- ---- class cewcombobox ---- ----

public class newcombobox
inberits combobox

public sub init(byval list as list(of string))
for each item as string in list
me.items.add(new newitem with {.value=item})
next
end sub

protected overrides sub ondropdown
flag.closed=true
me.refreshitems
end sub

protected overrides sub ondropdownclosed
flag.closed=false
me.refreshitems=false
end sub

end class

---- ---- class flag ---- ----

public class flag
public shared closed as boolean
end class

---- ---- class newitem ---- ----

public class newitem
public value as string

public overrides function tostring as string
if flag.closed
return value
else
return value.split("(")(0)
endif
end function

end class

---- ---- class testform ---- ----

class testform

sub main
dim list as new list(of string)

for i as integer = 0 to 9
list.add(i.tostring & "(" & i.tostring & ")")
next

me.newcombobox1.init(list)
end sub

end class
...全文
265 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccm1818168 2015-04-30
  • 打赏
  • 举报
回复
不知道 就用我的代码试试吧 我这不是提问 只是在这留个底 以后忘记了好找
rmini 2014-11-07
  • 打赏
  • 举报
回复
不知道,继续关注

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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