We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

CurrentCell.MoveTo() hide rows !!!

Hi, I have two forms. In the first form I have a databoundgrid, in the second form I have a button that updates the grid inside form1. If both forms are openned and I press the button in form2, the form1.grid is refreshed with a datatable. If form1 is minimized and I press the button in form2 to refresh the grid in form1, there are some rows inside the grid that disapear. After refreshing the grid, I select the row that was selected before the refresh with: databoundgrid1.ForceCurrentCellMoveTo = True databoundgrid1.CurrentCell.MoveTo ( Selected_Index, 2) I realised that this strange behavior only happens when I execute this row: databoundgrid1.CurrentCell.MoveTo ( Selected_Index, 2) and only when the form1 is minimized. If it is not minimized, all goes as supposed to. Do you have any idea with this might happen ??? Thanks for your help. PS. I''m using 1.6.1.8 version.

3 Replies

AD Administrator Syncfusion Team May 18, 2004 04:21 PM UTC

If you comment out the //databoundgrid1.ForceCurrentCellMoveTo = True call, does the problem go away? Do you see any exceptions in your output window when this happens? What do you mean by ''refresh the grid'' here? Are you adding/removing rows from the grid''s datasource, or are you just changing the content of the datasource? What code are you using to do this refresh?


JL Jose Luis Melo May 19, 2004 09:34 AM UTC

>If you comment out the >//databoundgrid1.ForceCurrentCellMoveTo = True >call, does the problem go away? No. The problem continues... > >Do you see any exceptions in your output window when this happens? No, no exceptions... >What do you mean by ''refresh the grid'' here? >Are you adding/removing rows from the grid''s datasource, or are you just changing the content of the datasource? >What code are you using to do this refresh? This is the code, already mentioned in http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=12677 Dim index as integer = grid.CurrentCell.RowIndex '''''''' record the filter to a string Dim strFilter as string = dataset.Tables(1).DefaultView.RowFilter() Dim strSort as string = dataset.Tables(1).DefaultView.Sort() UpdateTable (1) '''''''' function that updates table in the dataset Dim filterBar As String = theFilterBar.RowFilter grid.BeginUpdate grid.GridBoundColumns.Clear() If Not (theFilterBar Is Nothing) And (theFilterBar.Wired) Then theFilterBar.RowFilter = "" theFilterBar.UnwireGrid() End If grid.DataSource = dataset.Tables(1) theFilterBar.WireGrid(grid) For col As Integer = 0 To grid.Model.ColCount Dim dt As DataTable = New DataTable dt = grid(1, col).DataSource() If Not (IsNothing(dt)) Then dt.Rows.RemoveAt(1) End If Next grid.Refresh() grid.EndUpdate() '''''''' here is the putting it again dataset.Tables(1).DefaultView.RowFilter() = strFilter dataset.Tables(1).DefaultView.Sort() = strSort theFilterBar.RowFilter = filterBar grid.ForceCurrentCellMoveTo = True grid.CurrentCell.MoveTo(index, 2) '' this is the line when executed, changes the rows NOTES: - only if I execute the row grid.CurrentCell.MoveTo(index, 2) with the form minimized, the problem happens. - i checked the values of filterBar and strFilter before executing this line, and both are not changed after executing this line. - what really happens: supposing the grid has 4 rows; if I select row 3 (index=3), the rows 1 and 2 dissapear when executing grid.CurrentCell.MoveTo(index, 2); if index=4, rows 1,2 and 3 dissappear; only the rows above the selected dissapear; header and filterbar''s row never dissapear, only rows from data table dissapear; Thanks again. Jose Melo


AD Administrator Syncfusion Team May 19, 2004 12:06 PM UTC

You can probably conditionally avoid the call by checking whether the form is minimized with code like (from memory so I may have something wrong here) If Me.grid.FindForm().WindowState <> FormWindowState.Minimized Then '' make the call EndIf As far as tracking down the reason that it is behaving badly, if you can send a sample project showing the problem we can look into it here.

Loader.
Live Chat Icon For mobile
Up arrow icon