TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Violeta Popa
NA
137
164.1k
autonumber column - datagridview
Mar 30 2013 6:21 AM
hello :) i have a datagridview populated from a bindingsource and i've tried in many ways to add an autonumber column. I've found some solutions on the Internet, but still doesn't work.:( here's my code:
SqlDataAdapter dataAdapter2 = new SqlDataAdapter("SELECT * FROM categorie_discount_adaos", conn);
dataAdapter2.Fill(dataSet, "categorie_discount_adaos");
categdaGridView.AutoGenerateColumns = false;
categdaBS.DataSource = dataSet.Tables["categorie_discount_adaos"];
categdaGridView.DataSource = categdaBS;
categdaGridView.Columns["denumire_categorie"].DataPropertyName = "denumire_categorie";
categdaGridView.Columns["tip_categorie"].DataPropertyName = "tip_categorie";
categdaGridView.Columns["procent"].DataPropertyName = "procent";
//i've tried this
int cellnum = 0;
int rownum = 0;
foreach (DataGridViewRow row in categdaGridView.Rows)
{
cellnum = cellnum + 1;
categdaGridView.Rows[rownum].Cells[0].Value = cellnum;
rownum = rownum + 1;
}
Reply
Answers (
0
)
Combining 2 gridviews
Extract Embedded Resource Files