如何创建数组类? [英] How to create array class?

查看:89
本文介绍了如何创建数组类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我创建了一个班级名员工。

接下来,我想为员工班级创建数组。

代码如下:

dim eply(5)as employee


当我打电话给eply(0).name =" Khrish" ,一个错误信息提示出来说

对象引用为空...


有什么想法解决它吗?

请建议。

提前谢谢。


Rgrds,

GL

试试这个:


dim eply(5)作为员工

eply(0)=新员工

eply(0).name =" Khrish"

Daniel写道:





我已经创建了一个类名员工。

接下来,我想为员工类创建数组。

代码如下:

dim eply(5)as employee


当我打电话给eply(0).name =" Khrish",一个错误信息sage提示出来说

对象引用为空...

有什么想法解决它吗?

请指教。

提前谢谢。


Rgrds,

GL

2007-01-07,Daniel< Da **** @ discussion.microsoft.comwrote:





我已经创建了一个类名员工。

接下来,我想为员工类创建数组。

代码如下:

dim eply(5)作为员工


当我调用eply(0).name =" Khrish"时出现错误消息提示

对象引用为空...


有什么想法解决它吗?

请指教。

谢谢提前完成。


Rgrds,

GL



Dim eply()As Employee { _

新员工(),_

新员工(),_

新员工(),_

新员工() ,_

新员工()}


-

Tom Shelton

丹尼尔,


2005年

http://www.vb-tips.com/dbpages.aspx?...b-9d0a3cf01846


我希望这会有所帮助,


Cor


Hi,

I have create a class name employee.
Next, i would like to create array for the employee class.
The code as below:
dim eply(5) as employee

when i call eply(0).name="Khrish", an error message prompt out as saying
object reference is null...

Any idea to solve it?
Please advice.
thank you in advance.

Rgrds,
GL

解决方案

try this:

dim eply(5) as employee
eply(0)=new employee
eply(0).name="Khrish"
Daniel wrote:

Hi,

I have create a class name employee.
Next, i would like to create array for the employee class.
The code as below:
dim eply(5) as employee

when i call eply(0).name="Khrish", an error message prompt out as saying
object reference is null...

Any idea to solve it?
Please advice.
thank you in advance.

Rgrds,
GL


On 2007-01-07, Daniel <Da****@discussions.microsoft.comwrote:

Hi,

I have create a class name employee.
Next, i would like to create array for the employee class.
The code as below:
dim eply(5) as employee

when i call eply(0).name="Khrish", an error message prompt out as saying
object reference is null...

Any idea to solve it?
Please advice.
thank you in advance.

Rgrds,
GL

Dim eply() As Employee { _
new Employee(), _
new Employee(), _
new Employee(), _
new Employee(), _
new Employee()}

--
Tom Shelton


Daniel,

For 2005

http://www.vb-tips.com/dbpages.aspx?...b-9d0a3cf01846

I hope this helps,

Cor


这篇关于如何创建数组类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆