怎样用vb创建一个类,请给个范例。谢谢!

climber 2000-03-22 03:43:00
怎样用vb创建一个类,请给个范例。谢谢!
...全文
257 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Janven 2000-03-23
  • 打赏
  • 举报
回复
有些话还是要说的,象你这样问法,分数花完了也提高不了多少的,还是找些书看看吧。没有的再问嘛!
easydone 2000-03-22
  • 打赏
  • 举报
回复
与创建一个STRUCTURE 相似/
Jake 2000-03-22
  • 打赏
  • 举报
回复
You should add a class module into the project.
choose project and click the add class module submenu.
Then please cofigure the property of the class .

you can declare the members and methods or property

'it's members
private mAmericanId as string
private mAmericanLen as integer
private enum mAmericanColor
green
red
.
.
.
end enum

....
....

' properties
public property let PigId ( vPigId as string)
mpigId = vPigId
end property
public property get PigId ( ) as string
mpigId = vPigId
end property
.....

'methods
public sub savetodb()

'you can add code to save the data to the table or database

end sub
.....

You add any method you want like to check the data and etc.

After that you can use the class in you program






climber 2000-03-22
  • 打赏
  • 举报
回复
我是说自己创建一个类!
Un1 2000-03-22
  • 打赏
  • 举报
回复
你是指自己“制造”一个类还是创建某个类的一个实例?如果是前者你在一个空类模块中写入一些Public过程甚至变量就行了,如果是后者使用New 操作符或 CreateObject 函数不就行了吗?

7,763

社区成员

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

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