I have a combobox that is contained within a user control.
Whilst the application is running, I'm attaching the combobox to a new
dataset. The problem I'm getting is that the combobox doesn't appear to
reflect the new dataset. The same code seems to work fine if the combobox
is set to the dataset on initialisation. What have I done wrong?
The code in full that I'm using to update the dataset and attach to the
combobox is as follows (the object jtmp is a link to a properietary
database, but I can see it cycling through this correctly).
dct = jtmp.ExtractDA(LookupAmc).DCount(m_DmsControl.VM)d t = New DataTable
ds = New DataSet
dv = New DataView
dt.TableName = "Data"
dt.Columns.Add("Id", System.Type.GetType("System.String"), "")
dt.Columns.Add("Description", System.Type.GetType("System.String"), "")
ds.Tables.Add(dt)
dv = ds.Tables("Data").DefaultView
Dim dr As DataRow
For cnt = 1 To dct
Try
If jtmp.Extract(m_LookupAmc, cnt).StartsWith("*") = False Then
Try
dr = dt.NewRow
dr.Item("Id") = cnt
dr.Item("Description") = jtmp.Extract(m_LookupAmc, cnt)
dt.Rows.Add(dr)
Catch
End Try
End If
Catch
End Try
Next cnt
dv.Sort = "Description"
txtLookup.ValueMember = Nothing
txtLookup.DataSource = Nothing
txtLookup.DisplayMember = Nothing
txtLookup.DisplayMember = "Description"
txtLookup.ValueMember = "Id"
txtLookup.DataSource = dv
txtLookup.Refresh()
Any clues as to what I've done wrong?
Thanks in advance
Simon