Home › Forums › WinForms controls › Xceed Grid for WinForms › Error occured when column header click
-
AuthorPosts
-
#16072 |
Hi
I have used following code sample to bind the data able to
the grid.GridControl1.BeginInit()
GridControl1.DataSource =
ds.Tables(0).DefaultViewGridControl1.ValueMember = “OrganizationID”
Dim cell As Xceed.Grid.DataCell
For Each cell In
GridControl1.DataRowTemplate.CellsAddHandler
cell.DoubleClick, AddressOf Me.cell_DoubleClickAddHandler
cell.MouseDown, AddressOf Me.cell_MouseDownAddHandler
cell.KeyDown, AddressOf Me.cell_KeyDownAddHandler
cell.Click, AddressOf Me.SelectedValueCahngeNext cell
For Each col As
Xceed.Grid.Column In GridControl1.ColumnsAddHandler
col.WidthChanged, AddressOf Me.cell_WidthChangeNext col
AddHandler
GridControl1.Resize, AddressOf Me.grid_ResizeAddHandler
GridControl1.DataRowTemplate.Cells(“CountryID”).ValueChanged,
AddressOf Me.FormatCountryColumnAddHandler GridControl1.DataRowTemplate.Cells(“VisitCountryID”).ValueChanged,
AddressOf Me.FormatCountryColumnGridControl1.EndInit()
FormatCountryColumn is used to replace the
country ID using the Country name.Private Sub FormatCountryColumn(ByVal
sender As Object,
ByVal e As
System.EventArgs)If TypeOf (sender) Is
Xceed.Grid.DataCell ThenDim cell
As Xceed.Grid.DataCell = CType(sender, Xceed.Grid.DataCell)If Not cell.Value Is
DBNull.Value AndAlso Not
cell.Value = “” Thencell.Value =
m_oCountry.GetCountryName(Convert.ToString(cell.Value))End If
End If
End Sub
In the first time grid load code is
successfully run.But when I click the “Country”
column header it raise the following error.When I disable the column header
sorting facility using ,.Columns(“CountryID”).CanBeSorted
= False then error is not raised.But column header sorting is a
requirement.Can you please help to resolve this?
Here is the error details
Message:The index must be greater than or equal to 0 and less than Count.
Parameter name: index
Actual value was 0.
Source:Xceed.Editors
Stack Trace: at Xceed.Utils.Exceptions.ThrowException.ThrowArgumentOutOfRangeException(String paramName, Object value, String message)
at Xceed.Utils.Collections.ListBase.ListGetItem(Int32 index)
at Xceed.Grid.Collections.VisibleRowList.get_Item(Int32 index)
at Xceed.Grid.PaintManager.CalculateBodyVisibleRows(Graphics graphics, Rectangle& gridRectangle)
at Xceed.Grid.PaintManager.Update()
at Xceed.Grid.PaintManager.GetVisibleRowFromRow(Row row)
at Xceed.Grid.PaintManager.GetVisibleCellFromCell(Cell cell)
at Xceed.Grid.PaintManager.GetVisualElementClientPosition(VisualGridElement element)
at Xceed.Grid.VisualGridElement.get_ClientPosition()
at Xceed.Grid.VisualGridElement.GridPointToClient(Point point)
at Xceed.Grid.GridControl.DoMouseUp(MouseEventArgs e)
at Xceed.Grid.GridControl.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at Xceed.Grid.GridControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)Also I have notice that when I
change the country ID to Country name “FormatCountryColumn”
function is executed again. ( I think event is fired again).Imported from legacy forums. Posted by Tharaka (had 809 views)
We are handling this issue through e-mail with the customer.
Imported from legacy forums. Posted by CharlesB (had 1096 views)
-
AuthorPosts
- You must be logged in to reply to this topic.