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
Mayank Jani
NA
477
76.3k
How to edit dataset bound datagridview?
Jan 18 2018 1:11 PM
Dear Members,
Greetings of the day...
you might found the subject familier and thought that the question has been answered on this site and on the net many times. but please read this at least once because, before posting my problem on this site, I have searched more than enough on net and on this site too. but not get any satisfactory answer.
so, I get an error message while try to add a row in a datagridview that, 'Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound.'
first please note that this is a Windows Application and I use MS Access as database.
after fetching the gridview data from database, I want to add some options to the datagridview from a combobox... at the time when I select the option from combobox, I get this error.
this is my code...
private void cmbFruits_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (btnSave.Text == "&Save")
{
dgvFruits.ColumnCount = 1;
dgvFruits.Columns[0].Width = 300;
dgvFruits.Rows.Add(cmbFruits.Text);
dgvFruits.Rows[0].Cells[0].Selected = false;
}
else
{
//THE ERROR OCCURS HERE.
dgvFruits.Rows.Add(cmbFruits.Text);
}
}
You are requested to advice for C# WinApp only and for MS Access.
Thank You
Mayank Jani
Reply
Answers (
4
)
How to Replace Last three slash from the url with comma(,)
learning c# language