how to get value from a newly added row?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nev
    Contributor
    • Oct 2007
    • 251

    how to get value from a newly added row?

    i place values in a new row programatically . it has an auto-increment column. after adding the entries i do...

    bindingsource.e ndedit()
    tableadapter.up date(dataset.da tatable)

    the saving process has no problem. now, i want to get the value of the new record's auto-increment column. if i do this...

    textbox.text = directcast(bind ingsource.curre nt,datarowview) ("Auto")

    it will generate an error, nullreferenceex ception was unhandled, Object reference not set to an instance of an object. and when i point the cursor to the bindingsource.c urrent line in debugmode, bindingsource.c urrent = nothing.

    how can i get the value in the auto-increment column of the newly added record.
  • nev
    Contributor
    • Oct 2007
    • 251

    #2
    i will need to get the data from my dataset datatable and not my bindingsource because somewhere in my code, i filter bindingsource.

    how do i get value of [auto] from dataset.datatab le?

    textbox.text = datadset.datata ble.???

    Comment

    • nev
      Contributor
      • Oct 2007
      • 251

      #3
      i got it myself...

      textbox.text = directcast(data set.datatable.d efaultview(reco rdindex),dataro wview)("Auto")

      Comment

      Working...