Rows

S

shapper

Hello,

I created a custom control, Parent, with the following property:

Property Rows As Generic.List(Of Row)

Row is another custom control that creates some code.

The problem is that I want to create different types of rows:
InputRow, CheckRow, ...

All rows render the same way, i.e., a div with content inside it. The
content in the div is different for each row.

Basically I would like to do something like:

Dim MyParent As Parent

MyParent.Rows.Add(MyNormalRow)

MyParent.Rows.Add(MyInputRow)

MyParent.Rows.Add(MyCheckRow)

....

What should be the best way to do this?

Thanks,

Miguel
 
H

Hans Kesting

It happens that shapper formulated :
Hello,

I created a custom control, Parent, with the following property:

Property Rows As Generic.List(Of Row)

Row is another custom control that creates some code.

The problem is that I want to create different types of rows:
InputRow, CheckRow, ...

All rows render the same way, i.e., a div with content inside it. The
content in the div is different for each row.

Basically I would like to do something like:

Dim MyParent As Parent

MyParent.Rows.Add(MyNormalRow)

MyParent.Rows.Add(MyInputRow)

MyParent.Rows.Add(MyCheckRow)

...

What should be the best way to do this?

Thanks,

Miguel

Create a baseclass "Row" (probably needs to derive from "Control") and
derive InputRow, CheckRow, etc from that Row.

You can put common functions in the baseclass and special functions in
the various derived classes.

Hans Kesting
 
S

shapper

It happens that shapper formulated :











Create a baseclass "Row" (probably needs to derive from "Control") and
derive InputRow, CheckRow, etc from that Row.

You can put common functions in the baseclass and special functions in
the various derived classes.

Hans Kesting

So by having my classes inherit from RowClass I then can add any of
the other classes directly in property of type Generic.List(Of Row).
Is this what you mean right?

Thanks,
Miguel
 
H

Hans Kesting

shapper explained :
So by having my classes inherit from RowClass I then can add any of
the other classes directly in property of type Generic.List(Of Row).
Is this what you mean right?

Thanks,
Miguel

Correct

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top