Hi,
Another bug that I don't get with Flygrid 1.0...:
When I open my form I get the exception : Specified cast is not valid.
Call Stack is at the line :
dgParams.Rows.DataSource = m_dsParams
Here's my code although I think it is correct and the issue must be elsewhere. Could you compare your code of 1.0 and 1.2 and try and investigate what are the differences/improvements made that could explain so many bugs ?
And please don't send me any samples as proof that my code should work. It doesn't prove anything since exceptions are raised depending on many factors.
Thank you
PrepareDisplayColumns()
dgDisplay.Rows.DataMember = m_dsDisplay.Tables(0).TableName
dgDisplay.Rows.DataSource = m_dsDisplay
PrepareParamsColumns()
dgParams.Rows.DataMember = m_dsParams.Tables(0).TableName
dgParams.Rows.DataSource = m_dsParams
Private Sub PrepareDisplayColumns()
'desc : we build the display token fields grid here
Dim tableloop As Integer
Dim dtEmp As DataTable
dtEmp = m_QToken.GetEmptyTable
dgDisplay.BeginInit()
dgDisplay.Columns.Items.Clear()
Dim col As New Column
col.FitMode = ColumnFitMode.SmartFit
Dim dc As DataColumn = m_dsDisplay.Tables(0).Columns(tableloop)
Dim ValueFieldType As New LookupListColumn("View Field Type", "ViewFieldTypeID")
ValueFieldType.LookupSource = m_dsDisplay.Tables(1)
ValueFieldType.LookupBoundField = "FieldTypeID"
ValueFieldType.LookupDisplayField = "FieldType"
col = ValueFieldType
dgDisplay.Columns.Items.Add(col)
Dim ViewTableValue As New LookupListColumn("View Table", "ViewTable")
ViewTableValue.LookupSource = m_dsSysInfo
ViewTableValue.LookupBoundField = "table_name"
ViewTableValue.LookupDisplayField = "table_name"
col = ViewTableValue
dgDisplay.Columns.Items.Add(col)
m_ViewFieldValue = New LookupListColumn("View Field", "ViewField")
m_ViewFieldValue.LookupSource = dtEmp
m_ViewFieldValue.LookupBoundField = "New"
m_ViewFieldValue.LookupDisplayField = "New"
col = m_ViewFieldValue
dgDisplay.Columns.Items.Add(col)
dgDisplay.EndInit()
End Sub
Private Sub PrepareParamsColumns()
'desc : we build the parameters grid here
Dim tableloop As Integer
Dim dtEmp As DataTable
dtEmp = m_QToken.GetEmptyTable
dgParams.BeginInit()
dgParams.Columns.Items.Clear()
Dim col As New Column
col.FitMode = ColumnFitMode.SmartFit
Dim dc As DataColumn = m_dsParams.Tables(0).Columns(tableloop)
m_ControlField = New LookupListColumn("Control Field", "ControlField")
m_ControlField.LookupSource = dtEmp
m_ControlField.LookupBoundField = "Id"
m_ControlField.LookupDisplayField = "New"
col = m_ControlField
dgParams.Columns.Items.Add(col)
Dim SourceOtherID As New LookupListColumn("Other Source", "SourceOtherID")
SourceOtherID.LookupSource = m_dsParams.Tables(3)
SourceOtherID.LookupBoundField = "SourceOtherID"
SourceOtherID.LookupDisplayField = "ParamSource"
col = SourceOtherID
dgParams.Columns.Items.Add(col)
Dim ParamFieldType As New LookupListColumn("View Field Type", "ViewFieldTypeID")
ParamFieldType.LookupSource = m_dsParams.Tables(1)
ParamFieldType.LookupBoundField = "FieldTypeID"
ParamFieldType.LookupDisplayField = "FieldType"
col = ParamFieldType
col.AllowSelect = False
dgParams.Columns.Items.Add(col)
Dim ViewTableParam As New LookupListColumn("View Table", "ViewTable")
ViewTableParam.LookupSource = m_dsSysInfo
ViewTableParam.LookupBoundField = "table_name"
ViewTableParam.LookupDisplayField = "table_name"
col = ViewTableParam
dgParams.Columns.Items.Add(col)
m_ViewFieldParam = New LookupListColumn("View Field", "ViewField")
m_ViewFieldParam.LookupSource = dtEmp
m_ViewFieldParam.LookupBoundField = "New"
m_ViewFieldParam.LookupDisplayField = "New"
col = m_ViewFieldParam
dgParams.Columns.Items.Add(col)
Dim OperatorID As New LookupListColumn("OperatorID", "OperatorId")
OperatorID.FitMode = ColumnFitMode.SmartFit
OperatorID.DropDownStyle = DropDownStyle.DropDownList
OperatorID.LookupSource = m_dsParams.Tables(2)
OperatorID.LookupBoundField = "ParamOperatorID"
OperatorID.LookupDisplayField = "ParamOperator"
col = OperatorID
dgParams.Columns.Items.Add(col)
Dim OperatorNotCol As New BooleanColumn("Operator Not", "OperatorNot")
OperatorNotCol.SupportNulls = True
dgParams.Columns.Items.Add(OperatorNotCol)
dgParams.EndInit()
End Sub