Adding data to DataGrid

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

Guest

I have got a prototype .Net2 WinForms that are binded to an Access DB Table
with some columns which have "default values".

I have allowed DataGrid to add data.

However, how could I get the "default values" in 2 columns to show up in new
row?
 
In addition, how could I control values that are allowed in another cell
value with a drop-down control?
 
Patrick,

Always try to access a DataGrid using the underlying dattable.

Cor
 
The DataGrid is already binded to the underlying DataTable.

But how do I code the grid so that
1) when a new row is inserted, I have default values pre-populated in 2
columns?
2) I have drop-down in 1 column to control values to be entered into the grid?
 
Patrick,

You know that you can set the default behaviour as well in the datatable. It
is a pity that this is not synchronized with by instance SQL server. You
have to set this in your program.

Cor
 
Can someone explain how I can code the .Net 2 DataGrid such that when a new
row is added, I can have a drop down to control the values that go into a
particular column?
 
i = DataGridView.CurrentRow.Index
If rows = 0 Then
i = OrderDetailsDataGridView.Rows.GetRowCount
DataGridViewElementStates.Displayed) - 1
End If
DataGridView.Item(0, i).Value = Me.combobox.selectedvalue.tostring()

where 0 is the column and i is the row
 
Back
Top