J
John
Dear all,
I have a question about adding a data row into the data
table. I have developed a form with a datagrid in it.
The datagrid is bound to a database table
named "products". I have added a "add" button into the
form and I write the following code:
dim newRec as datarow
newRec = dtProducts.NewRow()
newRec.BeginEdit
newRec(0) = ""
newRec.EndEdit
dtProducts.rows.add(newRec)
It works fine. The data row is appended to the end of the
datagrid when I click the "add" button. However, I don't
know how to set this row at the current row in the
datagrid. Do any one can help me? In addition, how can I
write the code to ensure that something must be entered in
the key column (cannot leave it blank). I have no idea
how to do it. Do any one give me some suggestion?
Thanks,
John
I have a question about adding a data row into the data
table. I have developed a form with a datagrid in it.
The datagrid is bound to a database table
named "products". I have added a "add" button into the
form and I write the following code:
dim newRec as datarow
newRec = dtProducts.NewRow()
newRec.BeginEdit
newRec(0) = ""
newRec.EndEdit
dtProducts.rows.add(newRec)
It works fine. The data row is appended to the end of the
datagrid when I click the "add" button. However, I don't
know how to set this row at the current row in the
datagrid. Do any one can help me? In addition, how can I
write the code to ensure that something must be entered in
the key column (cannot leave it blank). I have no idea
how to do it. Do any one give me some suggestion?
Thanks,
John