Hello
I encounter a problem migrating for fx10 to fx11. the compact framework 1.1 has a different behavior from th
previous framework 1.0 when working with combobox
I give hereafter the code used with FX10 and FX11, it works under FX10 and not in FX11. I tried to found a solution
but currently I solve the problem in simple program, but in a complex application with multiple screens
the behavior of the combobox is variable.
I've build the program using the VB.net help, the behavior with FX11 is not documented
Do i do something was wrong
Has Someone is solution ? Because It brings me sleepsless nigths !!!
Thanks for collaboratio
JP
Code used in FX1
Private Sub combobox_FX10(
'Create Datatable with standard VB Sampl
dt = DemonstrateDataTable(
dt.TableName = "Usine
'Create Datavie
dv = New DataView(dt
dv.Sort = "ProductID
'Create Datase
ds = New DataSet("Produits"
ds.Tables.Add(dt
'Standard code given in the VB.Net documentatio
cbDV.BeginUpdate(
cbDV.Sorted = Tru
'cbDV.SelectedIndex = -
'Load the DataView in the combobox datasource - WITHOUT BINDING
cbDV.DataSource = d
cbDV.DisplayMember = "ProductName
cbDV.ValueMember = "ProductID
cbDV.EndUpdate(
'Trac
'It Works
Debug.WriteLine("cbDV Count : " & cbDV.Items.Count
'Working with Framework 1.0, It doesn't Works with Compact Framework 1.
end su
Code used with FX1
Private Sub combobox(
'Create Datatable with standard VB Sampl
dt = DemonstrateDataTable(
dt.TableName = "Usine
'Create Datavie
dv = New DataView(dt
dv.Sort = "ProductID
'Create Datase
ds = New DataSet("Produits"
ds.Tables.Add(dt
'Bind TextBo
txtUsine.DataBindings.Clear(
' Binds a TextBox control to a column in the DataSet
txtUsine.DataBindings.Add("Text", ds, "Usine.ProductName"
'Bind First Combobox with D
cbDS.DataBindings.Clear(
cbDS.Sorted = Tru
cbDS.SelectedIndex = -
' Bind a Combobox control to a column in the DataSet
cbDS.DataBindings.Add("DisplayMember", ds, "Usine.ProductName"
cbDS.DataSource = ds.Tables("Usine"
cbDS.DisplayMember = "ProductName
cbDS.ValueMember = "ProductID
'Standard code given in the VB.Net documentation working with FX1
cbDV.BeginUpdate(
cbDV.Sorted = Tru
'cbDV.SelectedIndex = -
'Load the DataView in the combobox datasource - WITHOUT BINDING
cbDV.DataSource = d
cbDV.DisplayMember = "ProductName
cbDV.ValueMember = "ProductID
cbDV.EndUpdate(
'Trac
'It Works with FX11 and binding !!
Debug.WriteLine("cbDS Count : " & cbDS.Items.Count
'Working with Framework 1.0, It doesn't Works with Compact Framework 1.
Debug.WriteLine("cbDV Count : " & cbDV.Items.Count
end su
Private Function DemonstrateDataTable() As DataTabl
Dim myTable As DataTabl
myTable = New DataTabl
' add column
Dim column As DataColum
column = myTable.Columns.Add("ProductID", GetType(Integer)
column.AutoIncrement = Tru
column = myTable.Columns.Add("ProductName", GetType(String)
' populate DataTable
Dim id As Intege
For id = 1 To
myTable.Rows.Add(
New Object() {id, String.Format("product{0}", id)}
Next i
Dim dv As DataVie
dv = New DataView(myTable
Return myTabl
End Function
|