Results 1 to 2 of 2

Thread: Setting values in a new row that a user is editing.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Houston, TX
    Posts
    342

    Setting values in a new row that a user is editing.

    I am using a bound datagrid and allowing the users to add rows to the datsource using the new row in the datagrid. However, I need to modify some cells in the row after the user fills out the first 2 column. How do I go about doing this?

    I can't use the .NewRow method because that appends another row under the one the user is editing.

    Any ideas??

    Thanks!!!

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Not sure if this is exactly what you're looking for, but here's how I do dataset updates from code:

    Code:
    dsDataSet.Tables("TableName").Rows.Find("KeyField").BeginEdit()
    dsDataSet.Tables("TableName").Rows.Find("KeyField").Item("ItemToChange") = "SomeValue"
    dsDataSet.Tables("TableName").Rows.Find("KeyField").EndEdit()
    dsDataSet.Tables("TableName").Rows.Find("KeyField").AcceptChanges()
    Sounds like you want to update values in a record -after- the user has inserted that record? Depending on how your data source is defined the syntax may not be exactly right, but I happened to use this a little while ago on a project I'm working on. I'm pretty green so there is probably a better way to do this but it seems to work fine for my purposes.

    If you want to do it before the record gets inserted I guess you could watch for a .CurrentCellChanged event but I don't think I'd do it that way (but what do I know heh)

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width