Hi,
I've build a datagridview with a particular style - docking, padding, row color ...
I'd like to re use this grid in another form. No drang and Drop possible or cut and paste because I'd like to build the grid programmaticaly...
Can I use something like a sub, structure, class
pseudo code :
Me
.TabControl.TabPages.Item(0).Controls.Add(myGrid(myBindingSource))I don't know exactly --- sorry for this newby question :-)
Can someone help me
Thanks

re use datagridview
gabigpa
I "fell" this is the answer to my question, but I'm probably too "young" to make it by myself...
Can you help a little more
Don't waste your time for me...If you don't have time, I will continue to search by myself
Thanks again
Richard Burte
- Write your own datagridview class named as myGrid inherited from DataGridView
- The class myGrid should be able to be created without parameter. That mean, if you include a
Public Sub New(ByVal pBindingSource as BindingSource)
You must also, include a
Public Sub New()
Without include "Public Sub New()", it means user cannot "myGrid" without parameter. In form design, all controls are assumed can be created without parameter.
- Include "myGrid" in a project which will generate an assembly of "mylibrary" of assembly type as Library.
- In a new project, add reference to this "mylibrary". In the form design of a new form in this new project, you WILL see there will a tool icon of "myGrid" in a tag of "myLibrary" in form design toolbox. You can drag and drop your "myGrid" to the new form and further change any your "own properties" defined in "myGrid" in the property page of "myGrid". So, try write some property in "myGrid" controlling the behaviour of you "myGrid".
- This steps applied to any inherited control.
I hope this would help.
Daniel Westlake
i will explicit a little bit
Thanks a lot for your help
MainForm
Imports
RaceTimingSoftware.myGridPublic
Class FormMainEnd Class
MyCLASS
Public
Class myGrid Inherits DataGridView Public Sub New(ByVal myBinding As BindingSource, ByVal myName As String) ...BackgroundColor = System.Drawing.SystemColors.Control
Dock = System.Windows.Forms.DockStyle.Fill
DataSource = myBinding
Name = myName
...
End Class
Taufik
Jon Bishop
In actuality, the controls are added programatically. Look in the file {yourformname}.designer.vb. You will be able to copy what the designer does in your own subroutine.
(you will have to press the 'show all files' button in the solution view, and it is a child of the {yourformname}.vb entry).