Datagrid display problem

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

    #1

    Datagrid display problem

    I have a datagrid on my form that displays its data from various tables
    within a specified dataset.
    That all works correclty.

    However, when one cell is selected prior to changed the displayed table, the
    cell from the old table remains visible, infront of the new tables data...?!

    I have tried 'datagrid.refre sh', 'DataGrid1.Data Source = nothing' and all
    sort of tricks to try and update the display, but to no avail. My code looks
    like this to update the datagrid:

    Private Sub PopulateGridWit hTable2(ByVal Keyword As String, byVal Value as
    int)

    DataGrid1.DataS ource = Table2

    DataGrid1.Visib le = True

    Dim myDataColumn As DataColumn

    Dim myDataRow As DataRow

    myDataRow = Table2.NewRow()

    myDataRow("Keyw ord") = Keyword

    myDataRow("Valu e") = Value

    Table2.Rows.Add (myDataRow)

    DataGrid1.Refre sh()

    End Sub



    If anyone can help - please post a quick reply. Its driving me nuts.


  • Kyjan

    #2
    Re: Datagrid display problem

    There have been various posts on the newsgroups concerning this. It's
    a bug that's in the .NET Framework Service Pack 1. It has to do with
    GridColumnStyle s and the ReadOnly attribute from what I understand.

    Some people have said that if you change ReadOnly to false before
    updating the DataGrid that it will solve the problem; however, I have
    not been able to solve the problem yet. I would also be interested to
    hear what other people have on this.

    Raymond

    Comment

    • JJ

      #3
      Re: Datagrid display problem

      Can anyone help with this? I'm having a real problem getting the datagrid to
      get rid of a cell in a table that has the cursor in it. Even when changing
      the datasource to another table and displaying its cells, the previous cell
      with the cursor in it remains displayed in front of any new tables.

      Any suggestions?


      "JJ" <abc@xyz.com> wrote in message
      news:OeF7rtmLGH A.2336@TK2MSFTN GP12.phx.gbl...[color=blue]
      >I have a datagrid on my form that displays its data from various tables
      >within a specified dataset.
      > That all works correclty.
      >
      > However, when one cell is selected prior to changed the displayed table,
      > the cell from the old table remains visible, infront of the new tables
      > data...?!
      >
      > I have tried 'datagrid.refre sh', 'DataGrid1.Data Source = nothing' and all
      > sort of tricks to try and update the display, but to no avail. My code
      > looks like this to update the datagrid:
      >
      > Private Sub PopulateGridWit hTable2(ByVal Keyword As String, byVal Value as
      > int)
      >
      > DataGrid1.DataS ource = Table2
      >
      > DataGrid1.Visib le = True
      >
      > Dim myDataColumn As DataColumn
      >
      > Dim myDataRow As DataRow
      >
      > myDataRow = Table2.NewRow()
      >
      > myDataRow("Keyw ord") = Keyword
      >
      > myDataRow("Valu e") = Value
      >
      > Table2.Rows.Add (myDataRow)
      >
      > DataGrid1.Refre sh()
      >
      > End Sub
      >
      >
      >
      > If anyone can help - please post a quick reply. Its driving me nuts.
      >
      >[/color]


      Comment

      • JJ

        #4
        Re: Datagrid display problem

        I chose to avoid this problem by having a datagrid for each table. Not the
        best solution I'm sure, but I could not think of any other simple way around
        it.


        "JJ" <abc@xyz.com> wrote in message
        news:Ox3lDxKMGH A.208@tk2msftng p13.phx.gbl...[color=blue]
        > Can anyone help with this? I'm having a real problem getting the datagrid
        > to get rid of a cell in a table that has the cursor in it. Even when
        > changing the datasource to another table and displaying its cells, the
        > previous cell with the cursor in it remains displayed in front of any new
        > tables.
        >
        > Any suggestions?
        >
        >
        > "JJ" <abc@xyz.com> wrote in message
        > news:OeF7rtmLGH A.2336@TK2MSFTN GP12.phx.gbl...[color=green]
        >>I have a datagrid on my form that displays its data from various tables
        >>within a specified dataset.
        >> That all works correclty.
        >>
        >> However, when one cell is selected prior to changed the displayed table,
        >> the cell from the old table remains visible, infront of the new tables
        >> data...?!
        >>
        >> I have tried 'datagrid.refre sh', 'DataGrid1.Data Source = nothing' and all
        >> sort of tricks to try and update the display, but to no avail. My code
        >> looks like this to update the datagrid:
        >>
        >> Private Sub PopulateGridWit hTable2(ByVal Keyword As String, byVal Value
        >> as int)
        >>
        >> DataGrid1.DataS ource = Table2
        >>
        >> DataGrid1.Visib le = True
        >>
        >> Dim myDataColumn As DataColumn
        >>
        >> Dim myDataRow As DataRow
        >>
        >> myDataRow = Table2.NewRow()
        >>
        >> myDataRow("Keyw ord") = Keyword
        >>
        >> myDataRow("Valu e") = Value
        >>
        >> Table2.Rows.Add (myDataRow)
        >>
        >> DataGrid1.Refre sh()
        >>
        >> End Sub
        >>
        >>
        >>
        >> If anyone can help - please post a quick reply. Its driving me nuts.
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...