Click here to Skip to main content
15,917,795 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
See more:
I was wondering if datagridview works in a usercontrol form, as I've done it but it doesnt seem to be loading and I've got 6 other Windows forms where it works perfectly.

I have created a user control form, and inserted a datagridview and selected the data I wish to view inside the table also

Is it possible? I've googled it but there's not much information on it

What I have tried:

Tried in a windows form - not much information on it using C# websites
Updated 10-Oct-22 11:52am
[no name] 11-Apr-18 14:35pm    
Grid control perfectly works fine when included in User controls. There should be some issue with your code only while loading/binding data to it.

Should be possible, see example here: Multiple Cell Edit Custom DataGridView[^]
and here: DataGridView based user control with edit dialog[^]

Did you try maybe to put a Form in a User control ? that is not how user controls should be used, you should put your user control in a Form ...
Share this answer
Inside your user control's surface, add a panel, or a Flow Layout panel, or another container control. Then dock the panel to the user control all around. Then add you DataGridView and other controls. You may find that helps the DataGridView work better.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900