Class inheritance

  • Thread starter Thread starter Scott Adams
  • Start date Start date
S

Scott Adams

This is an easy question for many of you; I just can't seem to be catching
everything.
I am trying to create a custom DataGrid class that, of course, inherits from
System.Windows.Forms.DataGrid. The only thing I am trying to do is add a
method to the class called ScrollToRow() that automatically scrolls to a
specifc row in the datagrid based on the "row" argument as displayed below:
Public Class DataGridCustom
Inherits DataGrid
Sub ScrollToRow(ByVal row As Integer)
Me.GridVScrolled(Me, New
ScrollEventArgs(ScrollEventType.LargeIncrement, row))
End Sub
End Class

I have tried declaring an object of DataGridCustom in code and setting all
of its properties (including datasource) at run-time, but the grid is not
visible for some reason and I have tried just about everything I know to
make it visible.
My questions are:
1. can I reference this custom datagrid in the designer?
2. what am I doing wrong so that it is not visible/showing up?
 
You could place your datagrid in a separate project (class library) so it
compiles into a dll. Then you can drag and drop this dll from the windows
explorer on the VS.NET toolbox.

Or you can rightclick on the toolbox and choose Add/Remove items... and then
browse to your dll.
 
Back
Top