在类模块中如何使用控件中的类模块

孙泳勇 2006-02-22 08:36:57
如题,比如我要在一个类模块中用一个LABEL的类模块
private withevents label1 as label
但这样只有控件的事件格式
但label1不是一个对象
我应该怎么做
...全文
57 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
孙泳勇 2006-02-22
  • 打赏
  • 举报
回复
private labelcl as Label     '这儿又用不了NEW
private withevents Label1 as Label

Private Sub Class_Initialize()
set withevents=labelcl
end sub

public property let Caption(Data as string)
label1.caption=data
end property
public property get Caption()as string
caption=label1.caption
end property
当设置和读取属性时出错,该怎么办
rainstormmaster 2006-02-22
  • 打赏
  • 举报
回复
//但label1不是一个对象
我应该怎么做

实例化
truewill 2006-02-22
  • 打赏
  • 举报
回复
做个函数咯
public sub SetLabel(lbl as Label)
set label1 = lbl
end sub

7,757

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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