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.