datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dmitry Akselrod

    #1

    datagrid

    Hi,



    I am using a standard .NET 1.0 Datagrid. Actually, I am using two, bound to
    a master-detail relationship. Both DataGrids are bound to a datasource. I
    have the MSDN version of the DateTime picker functioning quite well in the
    datagrid. I am also tracking a double-click event within another column in
    the datagrid. The column is just text. When the double-click event trigger
    fires, I load a borderless form, from which a user can pick an item from a
    ListBox control. Once the user picks an item, the item text is entered into
    the cell the user double-clicked on.



    datagrid1.item( datagrid1.curre ntrowindex, datagrid.curren tcell.colnumber ) =
    frmPopUp.lbCont rol1.selectedIt em()



    I then automatically move the user input to the next cell to the right. The
    value from the listbox is entered into the cell. However, the datagrid does
    not acknowledge that any changes were made to the dataset. It seems that
    the datagrid change detection is bound to user input, such a keyboard event.



    I have attempted to surround the datagrid.item property with BeginEdit and
    EndEdit methods, to no avail. I have attempted to use CurrencyManager . I
    tried incrementing and decrementing currentrowindex values, etc. I just
    can't get the datagrid to see that a change was made.



    Of course, if you any column values in the same row, such as the
    datatimepicker value, a change to the row is detected.



    Is there anyway I can get the datagrid to recognize that changes were made
    besides writing my own ColumnStyle?



    TIA

    Dmitry


  • Rick Rothstein [MVP - Visual Basic]

    #2
    Re: datagrid

    Almost everybody in this newsgroup is using VB6 or lower. While
    you may get a stray answer to VB.NET (including VB2003 and VB2005
    which has dropped .NET from its name) questions here, you should
    ask them in newsgroups devoted exclusively to .NET programming
    (the languages are different enough to warrant separate newsgroup
    support). Look for newsgroups with either the word "dotnet" or
    "vsnet" in their name.

    For the microsoft news server, try these newsgroups for Visual
    Basic .NET related questions...

    microsoft.publi c.dotnet.langua ges.vb
    microsoft.publi c.dotnet.langua ges.vb.upgrade
    microsoft.publi c.dotnet.langua ges.vb.controls
    microsoft.publi c.dotnet.langua ges.vb.data

    And these for more general .NET questions

    microsoft.publi c.dotnet.genera l
    microsoft.publi c.vsnet.general

    Note: There are many other .NET newgroups (use the first three
    "fields" from the last two as templates when searching for them),
    but the above ones should get you started.

    Rick



    "Dmitry Akselrod" <dmitry@nospam. com> wrote in message
    news:stOdnaGtmd bwHvbeRVn-vA@comcast.com. ..[color=blue]
    > Hi,
    >
    >
    >
    > I am using a standard .NET 1.0 Datagrid. Actually, I am using[/color]
    two, bound to[color=blue]
    > a master-detail relationship. Both DataGrids are bound to a[/color]
    datasource. I[color=blue]
    > have the MSDN version of the DateTime picker functioning quite[/color]
    well in the[color=blue]
    > datagrid. I am also tracking a double-click event within[/color]
    another column in[color=blue]
    > the datagrid. The column is just text. When the double-click[/color]
    event trigger[color=blue]
    > fires, I load a borderless form, from which a user can pick an[/color]
    item from a[color=blue]
    > ListBox control. Once the user picks an item, the item text is[/color]
    entered into[color=blue]
    > the cell the user double-clicked on.
    >
    >
    >
    > datagrid1.item( datagrid1.curre ntrowindex,[/color]
    datagrid.curren tcell.colnumber ) =[color=blue]
    > frmPopUp.lbCont rol1.selectedIt em()
    >
    >
    >
    > I then automatically move the user input to the next cell to the[/color]
    right. The[color=blue]
    > value from the listbox is entered into the cell. However, the[/color]
    datagrid does[color=blue]
    > not acknowledge that any changes were made to the dataset. It[/color]
    seems that[color=blue]
    > the datagrid change detection is bound to user input, such a[/color]
    keyboard event.[color=blue]
    >
    >
    >
    > I have attempted to surround the datagrid.item property with[/color]
    BeginEdit and[color=blue]
    > EndEdit methods, to no avail. I have attempted to use[/color]
    CurrencyManager . I[color=blue]
    > tried incrementing and decrementing currentrowindex values, etc.[/color]
    I just[color=blue]
    > can't get the datagrid to see that a change was made.
    >
    >
    >
    > Of course, if you any column values in the same row, such as the
    > datatimepicker value, a change to the row is detected.
    >
    >
    >
    > Is there anyway I can get the datagrid to recognize that changes[/color]
    were made[color=blue]
    > besides writing my own ColumnStyle?
    >
    >
    >
    > TIA
    >
    > Dmitry
    >
    >[/color]


    Comment

    • Dmitry Akselrod

      #3
      Re: datagrid

      I was able to solve my problem. I am posting a reply just in case someone
      encounters the same issue.

      The answer is that you cannot send an "I am editing this control"
      notification to the DataGrid without inheriting a Column style in some way
      shape or form. The quickest way I found to do this was to inherit the
      DataGridTextBox Column style and expose the .ColumnStartedE diting protected
      method. You can then call a public version of this method in your code.
      This will mark the row you are editing as changed.

      dmitry

      "Dmitry Akselrod" <dmitry@nospam. com> wrote in message
      news:stOdnaGtmd bwHvbeRVn-vA@comcast.com. ..[color=blue]
      > Hi,
      >
      >
      >
      > I am using a standard .NET 1.0 Datagrid. Actually, I am using two, bound
      > to a master-detail relationship. Both DataGrids are bound to a
      > datasource. I have the MSDN version of the DateTime picker functioning
      > quite well in the datagrid. I am also tracking a double-click event
      > within another column in the datagrid. The column is just text. When the
      > double-click event trigger fires, I load a borderless form, from which a
      > user can pick an item from a ListBox control. Once the user picks an
      > item, the item text is entered into the cell the user double-clicked on.
      >
      >
      >
      > datagrid1.item( datagrid1.curre ntrowindex, datagrid.curren tcell.colnumber )
      > = frmPopUp.lbCont rol1.selectedIt em()
      >
      >
      >
      > I then automatically move the user input to the next cell to the right.
      > The value from the listbox is entered into the cell. However, the
      > datagrid does not acknowledge that any changes were made to the dataset.
      > It seems that the datagrid change detection is bound to user input, such a
      > keyboard event.
      >
      >
      >
      > I have attempted to surround the datagrid.item property with BeginEdit and
      > EndEdit methods, to no avail. I have attempted to use CurrencyManager . I
      > tried incrementing and decrementing currentrowindex values, etc. I just
      > can't get the datagrid to see that a change was made.
      >
      >
      >
      > Of course, if you any column values in the same row, such as the
      > datatimepicker value, a change to the row is detected.
      >
      >
      >
      > Is there anyway I can get the datagrid to recognize that changes were made
      > besides writing my own ColumnStyle?
      >
      >
      >
      > TIA
      >
      > Dmitry
      >
      >[/color]


      Comment

      • Rick Rothstein [MVP - Visual Basic]

        #4
        Re: datagrid

        I just noticed you cross-posted to both a VB.NET newsgroup and a
        non-VB.NET (that is, classic version of VB) newsgroup. So that it
        is clear, my other response to your post was from the
        microsoft.publi c.vb.general.di scussion newsgroup. Just so you are
        aware, the solution you posted has zero applicability (and
        meaning) to the people for whom this newsgroup serves; hence, you
        should leave the microsoft.publi c.vb.general.di scussion newsgroup
        out of any of your future postings. Thank you.

        Rick


        "Dmitry Akselrod" <dmitry@nospam. com> wrote in message
        news:5q2dnVOGJI RzaPLenZ2dnUVZ_ tidnZ2d@comcast .com...[color=blue]
        > I was able to solve my problem. I am posting a reply just in[/color]
        case someone[color=blue]
        > encounters the same issue.
        >
        > The answer is that you cannot send an "I am editing this[/color]
        control"[color=blue]
        > notification to the DataGrid without inheriting a Column style[/color]
        in some way[color=blue]
        > shape or form. The quickest way I found to do this was to[/color]
        inherit the[color=blue]
        > DataGridTextBox Column style and expose the .ColumnStartedE diting[/color]
        protected[color=blue]
        > method. You can then call a public version of this method in[/color]
        your code.[color=blue]
        > This will mark the row you are editing as changed.
        >
        > dmitry
        >
        > "Dmitry Akselrod" <dmitry@nospam. com> wrote in message
        > news:stOdnaGtmd bwHvbeRVn-vA@comcast.com. ..[color=green]
        > > Hi,
        > >
        > >
        > >
        > > I am using a standard .NET 1.0 Datagrid. Actually, I am using[/color][/color]
        two, bound[color=blue][color=green]
        > > to a master-detail relationship. Both DataGrids are bound to[/color][/color]
        a[color=blue][color=green]
        > > datasource. I have the MSDN version of the DateTime picker[/color][/color]
        functioning[color=blue][color=green]
        > > quite well in the datagrid. I am also tracking a double-click[/color][/color]
        event[color=blue][color=green]
        > > within another column in the datagrid. The column is just[/color][/color]
        text. When the[color=blue][color=green]
        > > double-click event trigger fires, I load a borderless form,[/color][/color]
        from which a[color=blue][color=green]
        > > user can pick an item from a ListBox control. Once the user[/color][/color]
        picks an[color=blue][color=green]
        > > item, the item text is entered into the cell the user[/color][/color]
        double-clicked on.[color=blue][color=green]
        > >
        > >
        > >
        > > datagrid1.item( datagrid1.curre ntrowindex,[/color][/color]
        datagrid.curren tcell.colnumber )[color=blue][color=green]
        > > = frmPopUp.lbCont rol1.selectedIt em()
        > >
        > >
        > >
        > > I then automatically move the user input to the next cell to[/color][/color]
        the right.[color=blue][color=green]
        > > The value from the listbox is entered into the cell. However,[/color][/color]
        the[color=blue][color=green]
        > > datagrid does not acknowledge that any changes were made to[/color][/color]
        the dataset.[color=blue][color=green]
        > > It seems that the datagrid change detection is bound to user[/color][/color]
        input, such a[color=blue][color=green]
        > > keyboard event.
        > >
        > >
        > >
        > > I have attempted to surround the datagrid.item property with[/color][/color]
        BeginEdit and[color=blue][color=green]
        > > EndEdit methods, to no avail. I have attempted to use[/color][/color]
        CurrencyManager . I[color=blue][color=green]
        > > tried incrementing and decrementing currentrowindex values,[/color][/color]
        etc. I just[color=blue][color=green]
        > > can't get the datagrid to see that a change was made.
        > >
        > >
        > >
        > > Of course, if you any column values in the same row, such as[/color][/color]
        the[color=blue][color=green]
        > > datatimepicker value, a change to the row is detected.
        > >
        > >
        > >
        > > Is there anyway I can get the datagrid to recognize that[/color][/color]
        changes were made[color=blue][color=green]
        > > besides writing my own ColumnStyle?
        > >
        > >
        > >
        > > TIA
        > >
        > > Dmitry
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...