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
Ankush
NA
267
63k
Adding checkbox column in datagridview at specific position.
Mar 21 2016 11:53 AM
I am developing a windows application using c#.
I have a datagridview in which the data is coming from database based on the value selected in combobox on form, now I want to add checkbox column at first position ( Checkbox column should be first column )
dgvDetails.DataSource = dt;
//dt is DataTable
DataGridViewCheckBoxColumn chk =
new
DataGridViewCheckBoxColumn();
chk.HeaderText =
""
;
chk.Width = 30;
chk.Name =
"chk"
;
dgvDetails.Columns.Insert(0, chk);
dgvDetails.Columns[1].DataPropertyName =
"Trans_ID"
;
dgvDetails.Columns[1].HeaderText =
"Trans ID"
;
dgvDetails.Columns[2].DataPropertyName =
"UserName"
;
dgvDetails.Columns[2].HeaderText =
"User Name"
;
I wrote the following code :-
The number of rows depend upon the value selected in combobox.
This doesn't work properly. When the form is loaded and the value in combobox is selected the checkbox column appears as first column and the data also appears correctly, but when the combobox selected value is changed, the data in datagirdview is jumbled and error occurs
Reply
Answers (
4
)
sessions
No overload for method 'TryParse' takes '1' arguments