Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DataRowState not working as expected

DataRowState not working as expected

Scheduled Pinned Locked Moved C#
visual-studiocsharpdebuggingquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gmhanna
    wrote on last edited by
    #1

    Hi, I'm trying to determine if the row has been modified. I have used Visual Studio 2010 and dragged the controls onto the form, so VS has built everything. When a direction button on the navigator is clicked, I run this code.

     x = Convert.ToInt32(reunionBindingNavigator.PositionItem.Text);
     DataRow dr = KTReunionDataSet.Reunion.Rows\[x\];
     Debug.WriteLine(dr.RowState.ToString());
     if (dr.RowState == DataRowState.Modified)
         return;
    

    I start with row one, change the date on the calendar, click next, row 2 is now showing, don't modify anything on row 2, click the back button so we are now on Row 1, yet dr.RowState shows as UnModified. Did I do something wrong or am I missing something? Thank you,

    Glenn

    G 1 Reply Last reply
    0
    • G gmhanna

      Hi, I'm trying to determine if the row has been modified. I have used Visual Studio 2010 and dragged the controls onto the form, so VS has built everything. When a direction button on the navigator is clicked, I run this code.

       x = Convert.ToInt32(reunionBindingNavigator.PositionItem.Text);
       DataRow dr = KTReunionDataSet.Reunion.Rows\[x\];
       Debug.WriteLine(dr.RowState.ToString());
       if (dr.RowState == DataRowState.Modified)
           return;
      

      I start with row one, change the date on the calendar, click next, row 2 is now showing, don't modify anything on row 2, click the back button so we are now on Row 1, yet dr.RowState shows as UnModified. Did I do something wrong or am I missing something? Thank you,

      Glenn

      G Offline
      G Offline
      Gopal S
      wrote on last edited by
      #2

      Hi Glenn, I have used this code. It will work correctly. int x = Convert.ToInt32(bindingNavigator1.PositionItem.Text); DataRow dr = dt.Rows[x-1]; if (dr.RowState == DataRowState.Modified) { MessageBox.Show("Modified"); } I don't know what you have done in second line. Which component(KTReunionDataSet)you are using?. Thanks, Gopal.S

      Gopal.S

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups