Add and then edit a rec in ado.net with vb.net

  • Thread starter Thread starter Sal
  • Start date Start date
S

Sal

I have what I feel should be a simple operation, but I cannot seem to
get it to work. I have a table from a dataset that is bound to winform
controls. I would like to add a record, set some default values, and
the allow the nuser to edit the data. I am successful in adding the
data, but the controls remain blank. How do I position the dataset on
the new row and have that reflected in the controls?

Here is my code:

Dim drwTemp As DataRow = dsTars1.Tranactions.NewRow()
drwTemp("TransDate") = Date.Now
drwTemp("transcnt") = 2
drwTemp("actCode") = "2000"
drwTemp("Amount") = 10000
dsTars1.Tranactions.Rows.Add(drwTemp)


Thanks,

Sal
 
What controls are you binding to? If you are using BindingContext to
bind to text boxes and stuff, you need to move the CurrencyManager to
the position of the newly added row. If your binding to a data grid it
should happen on its own.

NuTcAsE
 
NuTcAsE said:
What controls are you binding to? If you are using BindingContext to
bind to text boxes and stuff, you need to move the CurrencyManager to
the position of the newly added row. If your binding to a data grid it
should happen on its own.

NuTcAsE

I am new to vb.net and sometimes make stupid mistakes. The contols
were not bound. Duh! I thought I did this but your reply made ,me
double check.


Thanks,
 
Back
Top