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