Home - Forums-.NET - FlyGrid.Net (Windows Forms) - inconsistencies between flygrid 1.0 and 1.2

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

inconsistencies between flygrid 1.0 and 1.2
Link Posted: 02-Sep-2005 03:36
Hi again,
I really don't want to sound harsh, but I'm getting really fed up with this control, particularly with part of my code that used to work fine with 1.0 and that suddenly don't work at all with 1.2 !!! I've gone back to 1.0 to make sure I didn't make any mistake in my own code, but indeed it works again using 1.0.

You don't seem to keep things consistent between versions of the control, and since we bought it recentely, we thought it is fair we give you some feedback. We do not want to have to change our code each time you release a new version, this is the basics of programming to keep things consistent anyway  

Now to get back to my problem, the following code is used to create two lookuplist columns:

        Dim ViewTableValue As New LookupListColumn("Table", "ViewTable")
        ViewTableValue.FitMode = ColumnFitMode.SmartFit
        ViewTableValue.DropDownStyle = DropDownStyle.DropDownList
        ViewTableValue.LookupSource = m_dtSysInfo
        ViewTableValue.LookupBoundField = "table_name"
        ViewTableValue.LookupDisplayField = "table_name"
        dgDisplay.Columns.Items.Add(ViewTableValue)

        Dim m_ViewFieldValue As New LookupListColumn("Field", "ViewField")
        m_ViewFieldValue.FitMode = ColumnFitMode.SmartFit
        m_ViewFieldValue.DropDownStyle = DropDownStyle.DropDownList
        m_ViewFieldValue.LookupSource = dtEmp
        m_ViewFieldValue.LookupBoundField = "New"
        m_ViewFieldValue.LookupDisplayField = "New"
        dgDisplay.Columns.Items.Add(m_ViewFieldValue)


Then when you select a value in the first column, the datasource of the second column is updated accordingly to the value selected in the first one:

              
SelectedViewTable = dt.Rows(dg.Selected.Index).Item("ViewTable").ToString
                dtViewFields = m_queries.GetViewFields(SelectedViewTable)
                col = DirectCast(dg.Columns.Items(pos), LookupListColumn)
                col.LookupSource = dtViewFields
                col.LookupBoundField = "column_name"
                col.LookupDisplayField = "column_name"
                dg.Columns.Items(pos) = col


With FlyGrid 1.2 this leads to the exception :

Index -2147481860 is not non-negative and below total rows count.

Can you help and tell me how to modify the code if necessary. Again, this code works just fine with FlyGrid 1.0 !

Regards
Link Posted: 04-Sep-2005 11:53
Sorry for delivered inconveniences, please download latest update (1.2.1),
LookupListColumn now supports DataTable as LookupSource.
Link Posted: 05-Sep-2005 21:12
Hi,
This issue is actually not fixed, although it might come from my code. Here is a better description of what's going on:

        'get the value/display fields
        m_dsDisplay = m_queries.GetQueryDisplayFields(m_queries.CurrentRecord.QueryID)
        PrepareValueColumns()

        dgDisplay.Rows.DataMember = m_dsDisplay.Tables(0).TableName
        dgDisplay.Rows.DataSource = m_dsDisplay


Now my methods PrepareColumns:

Private Sub PrepareValueColumns()
        'desc   : we build the value/display fields grid here
        Dim tableloop As Integer
        Dim dtEmp As DataTable

        dtEmp = m_queries.GetEmptyTable

        dgDisplay.BeginInit()
        dgDisplay.Columns.Items.Clear()

        Dim col As New Column("Name", "FieldName")
        dgDisplay.Columns.Items.Add(col)

        Dim ValueFieldType As New LookupListColumn("Field Type", "ViewFieldTypeID")
        ValueFieldType.FitMode = ColumnFitMode.SmartFit
        ValueFieldType.DropDownStyle = DropDownStyle.DropDownList
        ValueFieldType.LookupSource = m_dsDisplay.Tables(1)
        ValueFieldType.LookupBoundField = "FieldTypeID"
        ValueFieldType.LookupDisplayField = "FieldType"
        dgDisplay.Columns.Items.Add(ValueFieldType)


**************************************************
If this block of code is commented, all works fine, so I suspect the issue is somewhere there.

        Dim ViewTableValue As New LookupListColumn("Table", "ViewTable")
        ViewTableValue.FitMode = ColumnFitMode.SmartFit
        ViewTableValue.DropDownStyle = DropDownStyle.DropDownList
        ViewTableValue.LookupSource = m_dtSysInfo
        ViewTableValue.LookupBoundField = "table_name"
        ViewTableValue.LookupDisplayField = "table_name"
        dgDisplay.Columns.Items.Add(ViewTableValue)

****************************************************

        m_ViewFieldValue = New LookupListColumn("Field", "ViewField")
        m_ViewFieldValue.FitMode = ColumnFitMode.SmartFit
        m_ViewFieldValue.DropDownStyle = DropDownStyle.DropDownList
        m_ViewFieldValue.LookupSource = dtEmp
        m_ViewFieldValue.LookupBoundField = "New"
        m_ViewFieldValue.LookupDisplayField = "New"
        dgDisplay.Columns.Items.Add(m_ViewFieldValue)

        dgDisplay.EndInit()
    End Sub



After the line
dgDisplay.Rows.DataSource = m_dsDisplay


I get

Index -2147483648 is not non-negative and below total rows count.


Can you help ?

Regards
Link Posted: 06-Sep-2005 02:13
Probably you have non-empty DataMember property.
Link Posted: 06-Sep-2005 02:32
What do you mean by Non-empty DataMember property ?

dgDisplay.Rows.DataMember is  m_dsDisplay.Tables(0).TableName , as indicated in the previous message.  What might be wrong with that ?
Link Posted: 06-Sep-2005 11:19
We've made some LookupListcolumn improvements, try the latest version.
Also - I've published a LookuplistSample (Vb.Net), if LookupListColumn stiil incorrectly works - could you ''emulate' your problem on this sample?
you can download VB.Net sample here
Link Posted: 06-Sep-2005 21:54
Hallelujah !!!!
The new version fixes the bug I had in the other thread. I told you it was not coming from my code ! I'd be really curious to know what you have changed.

However this version does not correct the bug of this thread. It might come from my code though. I'll let you know and try your sample.

Thank you for your support and help.
Link Posted: 07-Sep-2005 05:06
I've fixed this one in this thread. Bug was in my code.