Home - Forums-.NET - FlyGrid.Net (Windows Forms) - issue with grid.rows.items.count

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

issue with grid.rows.items.count
Link Posted: 01-Sep-2005 00:35
Victor,

We have a major issue with the Flygrid 1.2. We have tried our code using Flygrid 1.0 to try and reproduce the bug, but it works just fine. Therefore we are assuming the issue comes from the new Flygrid. Here is some code where the issue occurs:

'FillBottomGrids is called once and then dgParams.Rows.Items.Count is 2.
'But if we call it a second time then dgParams.Rows.Items.Count is 0. Using Flygrid 1.0, dgParams.Rows.Items.Count is 'always 2 which is correct, as m_dsParams.Tables(0).Rows.Count is 2.

FillBottomGrids(dt)



'CODE FOR FillBottomGrids and related functions :

Public Sub FillBottomGrids(ByVal dt As DataTable)

    'm_dsParams is always the same (flygrid 1.0 or flygrid 1.2)
        m_dsParams = m_fields.GetParamFields(CInt(dt.Rows(m_SelectedControl).Item("FieldID")))
        PrepareParamsColumns()

        dgParams.Rows.DataMember = m_dsParams.Tables(0).TableName
        dgParams.Rows.DataSource = m_dsParams
End Sub

Private Sub PrepareParamsColumns()
        Dim tableloop As Integer
        Dim dtEmp As DataTable

        dtEmp = m_fields.GetEmptyTable

        dgParams.BeginInit()
        dgParams.Columns.Items.Clear()

        m_ControlField = New LookupListColumn("Control", "ControlField")
        m_ControlField.FitMode = ColumnFitMode.SmartFit
        m_ControlField.DropDownStyle = DropDownStyle.DropDownList
        m_ControlField.LookupSource = dtEmp
        m_ControlField.LookupDataMember = dtEmp.TableName
        m_ControlField.LookupBoundField = "Id"
        m_ControlField.LookupDisplayField = "New"
        dgParams.Columns.Items.Add(m_ControlField)

        Dim SourceOtherID As New LookupListColumn("Other Source", "SourceOtherID")
        SourceOtherID.FitMode = ColumnFitMode.SmartFit
        SourceOtherID.DropDownStyle = DropDownStyle.DropDownList
        SourceOtherID.LookupSource = m_dsParams
        SourceOtherID.LookupDataMember = m_dsParams.Tables(3).TableName
        SourceOtherID.LookupBoundField = "SourceOtherID"
        SourceOtherID.LookupDisplayField = "ParamSource"
        dgParams.Columns.Items.Add(SourceOtherID)

        Dim ParamFieldType As New LookupListColumn("Field Type", "ViewFieldTypeID")
        ParamFieldType.FitMode = ColumnFitMode.SmartFit
        ParamFieldType.DropDownStyle = DropDownStyle.DropDownList
        ParamFieldType.LookupSource = m_dsParams
        ParamFieldType.LookupDataMember = m_dsParams.Tables(1).TableName
        ParamFieldType.LookupBoundField = "FieldTypeID"
        ParamFieldType.LookupDisplayField = "FieldType"
        ParamFieldType.ReadOnly = True
        dgParams.Columns.Items.Add(ParamFieldType)

        m_ViewTableParam = New LookupListColumn("Table", "ViewTable")
        m_ViewTableParam.FitMode = ColumnFitMode.SmartFit
        m_ViewTableParam.DropDownStyle = DropDownStyle.DropDownList
        m_ViewTableParam.SortOrder = SortOrder.None
        m_ViewTableParam.LookupDataMember = m_dtRelations.TableName()
        m_ViewTableParam.LookupBoundField = "table_name"
        m_ViewTableParam.LookupDisplayField = "table_name"

        dgParams.Columns.Items.Add(m_ViewTableParam)

        m_ViewFieldParam = New LookupListColumn("Field", "ViewField")
        m_ViewFieldParam.FitMode = ColumnFitMode.SmartFit
        m_ViewFieldParam.DropDownStyle = DropDownStyle.DropDownList
        m_ViewFieldParam.LookupSource = dtEmp
        m_ViewFieldParam.LookupDataMember = dtEmp.TableName
        m_ViewFieldParam.LookupBoundField = "New"
        m_ViewFieldParam.LookupDisplayField = "New"
        dgParams.Columns.Items.Add(m_ViewFieldParam)

        Dim OperatorID As New LookupListColumn("Operator", "OperatorID")
        OperatorID.FitMode = ColumnFitMode.SmartFit
        OperatorID.DropDownStyle = DropDownStyle.DropDownList
        OperatorID.LookupSource = m_dsParams
        OperatorID.LookupDataMember = m_dsParams.Tables(2).TableName
        OperatorID.LookupBoundField = "ParamOperatorID"
        OperatorID.LookupDisplayField = "ParamOperator"
        dgParams.Columns.Items.Add(OperatorID)

        Dim OperatorNotCol As New BooleanColumn("Not Operator", "OperatorNot")
        OperatorNotCol.FitMode = ColumnFitMode.SmartFit
        dgParams.Columns.Items.Add(OperatorNotCol)

        dgParams.EndInit()
End Sub


Could you help us fixing this bug?

Kind Regards,
Link Posted: 01-Sep-2005 02:21
this incorrectness will fixed at the nearest days,
now include this code into FillBottomGrids method:

Public Sub FillBottomGrids(ByVal dt As DataTable)

     'm_dsParams is always the same (flygrid 1.0 or flygrid 1.2)
        m_dsParams = m_fields.GetParamFields(CInt(dt.Rows(m_SelectedControl).Item("FieldID")))
        PrepareParamsColumns()
        '--------------------------------------------------------------
        'disconnect from previously connected DataSource
        If (Not (dgParams.Rows.DataSource is Nothing))
           dgParams.Rows.DataSource = Nothing
        '--------------------------------------------------------------
        dgParams.Rows.DataMember = m_dsParams.Tables(0).TableName
        dgParams.Rows.DataSource = m_dsParams
End Sub
Link Posted: 01-Sep-2005 04:08
Thanks, we'll try this and look forward for the fix
Link Posted: 01-Sep-2005 04:35
Actually now that I think about it : I've spent half a day trying to spot where that bug was occuring. I knew it was coming from the new flygrid but I wasn't sure what was the problem (the exception raised was not explicit at all). Therefore, could you please maintain a list of known bugs and issues with each new release (some release notes would be helpful), so that in the future we don't have to waste so much time with bugs unrelated to our application. We would be very grateful for that.

Kind Regards
Link Posted: 05-Sep-2005 20:38
Solved