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
77.4k
How to add new row(s) in a databound datagridview in C# WinA
Sep 30 2019 12:39 AM
Hiii Members,
I am working on a C# WinApp. In a form there are two ComboBoxes and one DataGridView. the first ComboBox contains customer names, the second ComboBox contains products (fruits, vegitables, house holds etc). I have wrote a code that some customers have pre-added products saved in a DataTable so, when I select the customer's name from ComboBox, the pre-saved products automatically loads into the DataGridView.
problem is when I try to add a new product for the customer, system throws error, "ColumnCount property cannot be set on a data-bound DataGridView control."
when remove the ColumnCount property, it throws another error, "Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound."
I have googled many times but no solution working for me. DataGridView.DataSource = null; will not work because I want to add more row in existing (pre-loaded) list.
Please show me anyway to add a row in a databound datagridview C# WinApp.
Thanks
Mayank Jani
Reply
Answers (
7
)
how to remove items from json string in c#?
How to checks if two strings have the same letter pattern