Howto create class that inherits Datarowview?

  • Thread starter Thread starter Guillaume Hanique
  • Start date Start date
G

Guillaume Hanique

Hello,

I want to extend the datarowview, but I don't know how.

If I have:

Public Class MyClass
Inherits DataRowView

End Class

It says:
Class 'MyClass' must declare a 'Sub New' because its base class
'DataRowView' does not have an accessible 'Sub New' that can be called
with no arguments.

If then I have:

Public Class MyClass
Inherits DataRowView

Public Sub New()

End Sub
End Class

It says:
First statement of this 'Sub New' must be a call to 'MyBase.New' or
'MyClass.New' because base class 'System.Data.DataRowView' of
'SOSMailer.Class1' does not have an accessible 'Sub New' that can be
called with no arguments.

But the base class, datarowview, doesn't have a New method. And typing
MyClass.New as the first statement is nonsense. It would be a call to
itself. Anybody any idea? Or is it simply not possible to subclass any
class that doesn't have a constructor?

Thanks, Guillaume Hanique.
 
Hi,

What are you trying to do?
AFAIK DataRowView is internal to DataView and can't be created otherwise.
 
Hi,
Hi!
What are you trying to do?
I have a table of which I know which columns it contains. I would like
to cast a datarowview to my datarowview, that has the columnnames as
properties. See code below.

Dim MyCurrencyManager As CurrencyManager = _
CType, Me.BindingContext(MyDataView), CurrencyManager)
Dim CurrentRow As MYDATAROWVIEW = _
CType(MyCurrencyManager.Current, MYDATAROWVIEW)
Dim ID As Guid = CurrentRow.ID

The property ID is added to the datarowview. But as stated before, I
don't know how to accomplish this.
AFAIK DataRowView is internal to DataView and can't be created otherwise.
That explains a lot.

Thanks.
 

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

Back
Top