DataGridView - IsCurrentRowDirty

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill Yanaire

    #1

    DataGridView - IsCurrentRowDirty

    Using VB.NET 2005, Windows Form and I bind a DataGridView to a table

    dgvFees.DataSou rce = tbl


    I make some changes to the cells in the grid and when I leave the grid, I
    run the following code:

    For Each DR As DataGridViewRow In Me.dgvFees.Rows
    If dgvFees.IsCurre ntRowDirty = True Then
    ChangesDone = True
    Else
    ChangesDone = False
    End If
    Next



    Sometimes it works and sometimes it doesn't. I can't pinpoint why it does.
    I have debugged and there is no rhyme or reason as to why it isn't always
    true when changes are made.

    If anyone could give me some pointers, I would appreciate it.

    Thank you.


  • Cor Ligthert [MVP]

    #2
    Re: DataGridView - IsCurrentRowDir ty

    Bill,

    Ever watched where the cursor is as you run your test. In other words, did
    it leave the tested field after the change or not?

    Cor

    "Bill Yanaire" <bill@yanaire.c omschreef in bericht
    news:ezN1aoXnHH A.3512@TK2MSFTN GP06.phx.gbl...
    Using VB.NET 2005, Windows Form and I bind a DataGridView to a table
    >
    dgvFees.DataSou rce = tbl
    >
    >
    I make some changes to the cells in the grid and when I leave the grid, I
    run the following code:
    >
    For Each DR As DataGridViewRow In Me.dgvFees.Rows
    If dgvFees.IsCurre ntRowDirty = True Then
    ChangesDone = True
    Else
    ChangesDone = False
    End If
    Next
    >
    >
    >
    Sometimes it works and sometimes it doesn't. I can't pinpoint why it
    does. I have debugged and there is no rhyme or reason as to why it isn't
    always true when changes are made.
    >
    If anyone could give me some pointers, I would appreciate it.
    >
    Thank you.
    >
    >

    Comment

    • Bill Yanaire

      #3
      Re: DataGridView - IsCurrentRowDir ty

      Yes, I made changes to some cells and then clicked on another control, the
      code I posted ran. It just doesn't set the IsCurrentRowDir ty to true. I
      did step through the loop for each record and it was always false.


      "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
      news:uFwXC%23bn HHA.3968@TK2MSF TNGP06.phx.gbl. ..
      Bill,
      >
      Ever watched where the cursor is as you run your test. In other words, did
      it leave the tested field after the change or not?
      >
      Cor
      >
      "Bill Yanaire" <bill@yanaire.c omschreef in bericht
      news:ezN1aoXnHH A.3512@TK2MSFTN GP06.phx.gbl...
      >Using VB.NET 2005, Windows Form and I bind a DataGridView to a table
      >>
      >dgvFees.DataSo urce = tbl
      >>
      >>
      >I make some changes to the cells in the grid and when I leave the grid, I
      >run the following code:
      >>
      > For Each DR As DataGridViewRow In Me.dgvFees.Rows
      > If dgvFees.IsCurre ntRowDirty = True Then
      > ChangesDone = True
      > Else
      > ChangesDone = False
      > End If
      > Next
      >>
      >>
      >>
      >Sometimes it works and sometimes it doesn't. I can't pinpoint why it
      >does. I have debugged and there is no rhyme or reason as to why it isn't
      >always true when changes are made.
      >>
      >If anyone could give me some pointers, I would appreciate it.
      >>
      >Thank you.
      >>
      >>
      >
      >

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: DataGridView - IsCurrentRowDir ty

        Bill,

        The isDirty is a strange kind of property in dotNet (it is more used by Java
        and Unix AFAIK), we mostly use Haschanges on the datasource.

        Cor

        "Bill Yanaire" <bill@yanaire.c omschreef in bericht
        news:OORpcdhnHH A.3872@TK2MSFTN GP04.phx.gbl...
        Yes, I made changes to some cells and then clicked on another control, the
        code I posted ran. It just doesn't set the IsCurrentRowDir ty to true. I
        did step through the loop for each record and it was always false.
        >
        >
        "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
        news:uFwXC%23bn HHA.3968@TK2MSF TNGP06.phx.gbl. ..
        >Bill,
        >>
        >Ever watched where the cursor is as you run your test. In other words,
        >did it leave the tested field after the change or not?
        >>
        >Cor
        >>
        >"Bill Yanaire" <bill@yanaire.c omschreef in bericht
        >news:ezN1aoXnH HA.3512@TK2MSFT NGP06.phx.gbl.. .
        >>Using VB.NET 2005, Windows Form and I bind a DataGridView to a table
        >>>
        >>dgvFees.DataS ource = tbl
        >>>
        >>>
        >>I make some changes to the cells in the grid and when I leave the grid,
        >>I run the following code:
        >>>
        >> For Each DR As DataGridViewRow In Me.dgvFees.Rows
        >> If dgvFees.IsCurre ntRowDirty = True Then
        >> ChangesDone = True
        >> Else
        >> ChangesDone = False
        >> End If
        >> Next
        >>>
        >>>
        >>>
        >>Sometimes it works and sometimes it doesn't. I can't pinpoint why it
        >>does. I have debugged and there is no rhyme or reason as to why it isn't
        >>always true when changes are made.
        >>>
        >>If anyone could give me some pointers, I would appreciate it.
        >>>
        >>Thank you.
        >>>
        >>>
        >>
        >>
        >
        >

        Comment

        Working...