Answer the question
In order to leave comments, you need to log in
How to correctly display multiple tables on a form?
It is necessary to display several tables on the form for viewing.
It seemed to me that the most suitable for this is the DataGridView. It also seems to me that manually adding / updating rows in it is not correct, I decided to use a DataTable to store data. The problem is that when you programmatically change the data in the DataTable (cells), these changes are not displayed in the DataGridView. The new row is displayed, but changes to the existing row are not. Breaking a bunch of internet, tried using the BindingSource intermediate and the Update() and Refresh() methods of the DataGridView. Nothing helps.
Is it really necessary to rebind the source to the DataGridView every time the data changes so that it displays the changes? My data can be updated up to several times per second. And there are several tables.
Please help.
Answer the question
In order to leave comments, you need to log in
Everything works, it's my fault.
When creating a DataTable, I set ReadOnly = true for all columns, in this mode, even programmatically, you cannot change the data. I found out by adding a test button to the form, which added a line and changed the data - an error occurred.
Prior to this, all actions with the DataTable were done in an event subscription - no errors were displayed there. By the way why?
Maybe someone else has come across: when adding rows intensively, the DataGridView starts to glitch: the up/down buttons on the scroll disappear, the last row doubles for a fraction of a second (I made the table auto-scroll down dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows. Count - 1].Cells[0];).
How to treat it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question