Adding rows to a bound table that is bound to DataGridView(DataSou

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I add rows to a table like:

_dtManualOrderItem.Rows.Add(mo)

How does the DataGridView get notified of this event? I don't see a Bind or
Rebind method. If I remove the binding and readd it:

dgvOrderItems.DataSource = Nothing
dgvOrderItems.DataSource = _dtManualOrderItem

Then the columns that I want displayed disappear or are reset. Anyway the
result is I see columns that I don't want to see. How would be the best way
to add a row to the table and have it update the DataGridView?

Thank you.

Kevin
 
As an addition. I have been able to add rows to the table and the grid seems
to be updated (the Rows property shows an addition) but I don't see the
values of the rows on the display. After adding a row to the bound table do I
need to Update to get it to display?
 
I think I have found the problem but I am not sure about the solution. My
application defines the columns to be displayed as follows:

Dim dgTextCol As DataGridViewTextBoxColumn = New
DataGridViewTextBoxColumn()
dgTextCol.HeaderText = "Customer ID"
dgTextCol.Name = "CustomerID"
dgTextCol.Width = 60
dgTextCol.ReadOnly = True
dataGridView1.Columns.Add(dgTextCol)

When this code is introduced the columns in each of the rows go blank. If I
skip this then the columns are displayed. How else do I set these kind of
properties plus limit the columns that are displayed from the DataSet?

Somewhat related. Notice that the ReadOnly property is set for the the
column above I would like to make some columns ReadOnly and some editable. I
saw in the documentation that the ReadOnly property for the row overrides the
properties in the column. But I don't see where to set or clear the ReadOnly
property for a row.

Thank you for your help with these two questions.

Kevin
 
Back
Top