By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,190 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,190 IT Pros & Developers. It's quick & easy.

Class inheritance

P: n/a
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?
--
Scott Adams
~~ not the Dilbert guy ~~
~~ not the creator of the Adventure series ~~
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Scott Adams" <sc*********@npiusa.com> schreef in bericht
news:%2****************@TK2MSFTNGP12.phx.gbl...
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?
--
Scott Adams
~~ not the Dilbert guy ~~
~~ not the creator of the Adventure series ~~

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.