Click here to Skip to main content
12,955,891 members (67,018 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to make a dtatgridview manually or from their property(collection) and load data in the datagridview from the database.

Any one Can Help Me
Posted 17-Nov-12 19:07pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can populate datagridview by two way.

First you can create & map column in design view.
datagridview -> property -> columns -> Add column as your requirement (by defining field type, Column Header & others properties).

*Dont forget to mention DataPropertyName. It will be the field name of database column.

For populate Data:

In datasource you can specify table or dataset in which you fatch data from database server.

Second you can directly populate by datagridview.DataSource=table/datasource
Here column name of datagridview will be column name of table(database table).

Here is onother important things is AutoGenerateColumns:

If you specify datagridview.AutoGenerateColumns = true it means datagridview automatically generate column as per provided table (require for second option).
If you define all columns in design mode and don't want to hide extra field then set it to false (for first option).

by default it is true.
Zain -Ul- Arifeen 19-Nov-12 4:57am
how to specify table or dataset in which you fatch data from database server in th datasource.
sir, i am the beginner of this language.
plz,plz,plz, help me

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,719
CHill60 3,550
Maciej Los 3,153
ppolymorphe 2,060
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100