|
-
Mar 9th, 2004, 03:39 AM
#1
Thread Starter
New Member
Combobox binding issue
Combobox binding issue - yet another...
I have a employees table in a dataset - one field is reportsto - with can be another employeeId (Similiar to the nwind access sample)
I've populated a combobox (reportsto) with list of names and employeeID as follows:
Dim EmployeeList As ArrayList
Try
cboReportsTo.Items.Clear()
EmployeeList = m_MyDataSource.EmployeeList
If EmployeeList.Count <> 0 Then
cboReportsTo.DisplayMember = "FullName"
cboReportsTo.ValueMember = "ID"
cboReportsTo.DataSource = EmployeeList
End If
...
The combobox(reportsto) is bound to Reportsto field (ID) in the employee table as follows:
cboReportsTo.DataBindings.Add("SelectedValue", TheDS, "Employees.ReportsTo")
'Save a reference to the BindingManagerBase object.
m_Bmb = Me.BindingContext(TheDS, "Employees")
'Force a refresh of buttons
m_Bmb.Position = m_Bmb.Count
m_Bmb.Position = 0
...
Now when i navigate thro the table say forward using code like:
m_Bmb.Position += 1
The 'reportsto' combo does'nt always show an empty field for the records where the employee is a boss and therefore does'n't
report to anyone. For example - If the current records 'reportsto' is empty and we forward to the next record which shows 'joe' - say, in
this field - if we move back the was empty reportsto now shows 'joe'.
Can someone please suggest a workaround/solution for this issue.
Returning to the example - if i change the 'joe' field to empty and the try to update the dataset - the dataset thinks nothing has
changed and does nothing. Ideas/soutions welcomed.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|