Results 1 to 2 of 2

Thread: Dynamically updating a row in Datagridview

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Location
    Sydney Australia
    Posts
    1

    Dynamically updating a row in Datagridview

    Hi,
    I have a VB.NET 2005 windows forms app with a heaps of forms most with at least one datagridview on them. I've got most of it working however I'm stuck on one part. The grids are databound to tables in a dataset. When a user updates a new I want to change 2 read only cells on that row to record the userid and time of change. I've tried this in the CellValueChanged event but this causes a stackoverflowexception because, I guess, it then calls itself again and goes into a loop. My question is where do I put the code to update a cell dynamically when a user updates a cell in a row ?? I want to update these cells and then when they click the save button it does an update. The update is working fine, it's just updating the audit cells that is the problem.
    thanks
    Dave

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Dynamically updating a row in Datagridview

    The CellValueChanged event is the correct choice. You must just not have used appropriate code. As you haven't shown us the code you're using we can't tell you what's wrong with it. My guess is that you are setting these values for every column, when you should be ignoring the columns that you're actually setting. Obviously you don;t want to change the userid a time columns when the userid and time columns change, so you shouldn't.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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