[DataGridView] inherince


J

Johnny E. Jensen

Hello

Dot sure if this it the right group but here goes.

I'am using the DataGridView multiple times in my application, and then i'll
read a book on inherience, and that opend a new world for me. So i'll
Created a class that inherience from the DataGridView Like:
public class AWDataGridView : System.Windows.Forms.DataGridView

In the Dispose event i'll want to store some info about the DataGridView's
design into the registry. I'll store the columns display index, so if a user
changes the order on the columns, the next time he uses the View it stays as
he left it. To store this I'll need the name of the DataGridView. for that
i'll use the base.name property.

Eks: I'll have two AWDataGridView called view1 and view2. In the dispose
event i'll use the base.name to save info to registry. Next when user brings
up the view1 control it should load the info from registry, but i'll cant
get the base.name to be filled with 'view1' it's empty. The load call are
placed within the AWDataGridView constructor, and i'll think this is a bit
early - but where can i place the load call. When does base.name get the
name value?

Kind regards

Johnny Jensen
 
Ad

Advertisements

R

RobinS

There was a thread in one of the dotnet newsgroups in
the past six months about using inheritance on the
DataGridView with input from Linda Liu from Microsoft.
She seemed to indicate that you can't really use
inheritance for this control for some reason or other
that escapes me right at this moment.

You might want to search the microsoft.public.dotnet.* newsgroups
for Linda's name and "datagridview" and see if you can find
that post and make sure you're not wasting your life.

Robin S.
 
J

Johnny E. Jensen

Hey RobinS

In that case i'am doing something that is not legal but it works.

I'am using databinding a in the class i create the override
OnDatabindingComplete to expose the value for base.name. Mabye it works
because i'am not getting to deep into the datagridview control, but only
adding some methods that alter the allowed displayed columns and setting a
standard design.

It works just fine. So now when i need a DataGridView i a form or a
UserControl I don't have to redesign and re-code the registry read/write
part. I just use my own Component. This could properbly have been done
another way, but this way i really like.

Thank for replying

/Johnny E Jensen
 
Ad

Advertisements

R

RobinS

Cool. I'm glad you got it to work. I don't remember the particulars
of the postings, I just remember thinking to myself, "Be careful
if you do that." So whatever the problem was, you're apparently
not hitting it, which is great.

Robin S.
--------------------------------
 

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

Top