overriding EndInit in ISupportInitialize

  • Thread starter Thread starter Bill Foust
  • Start date Start date
B

Bill Foust

I have a class that is derived from DataSet. Since DataSet
already supports the ISupportInitialize interface, I can't
add it. However I can't seem to take control of that
callback either. The only thing I can do is declare my own
local EndInit() as new void EndInit() because EndInit in
the DataSet is not defined as virtual. This means that my
EndInit in my derived class never gets called. The
generated code is:

(System.ComponentModel.ISupportInitialize)
(this.MyClass1)).EndInit();

How can I get the EndInit in MyClass to get called,
because it isnt now. Or how can I get a similiar function
call at the end of the InitializeComponents() function?

Thanks
Bill
 
You CAN redeclare the interface in your derived class:

public class DataSetDescendant : DataSet,
System.ComponentModel.ISupportInitialize
{
public DataSetDescendant()
{
}

void System.ComponentModel.ISupportInitialize.BeginInit()
{
base.BeginInit();
}

void System.ComponentModel.ISupportInitialize.EndInit()
{
base.EndInit();
}
}

Palo
 
Thanks Palo! That did the trick!
Bill
-----Original Message-----
You CAN redeclare the interface in your derived class:

public class DataSetDescendant : DataSet,
System.ComponentModel.ISupportInitialize
{
public DataSetDescendant()
{
}

void System.ComponentModel.ISupportInitialize.BeginInit()
{
base.BeginInit();
}

void System.ComponentModel.ISupportInitialize.EndInit()
{
base.EndInit();
}
}

Palo

--
http://www.vbinfozine.com - genuine VB developer successes and
failures...weekly...FREE




.
 
Back
Top