Private Sub DataBinding()
Try
Dim bsTableName2 As String
bsTableName2 = "dbo.hrBranchSetup"
'cboOrganization.DataBindings.Clear()
'cboOrganization.DataBindings.Add(New Binding("Text", ds.Tables(bsTableName2), "OsID"))
brCode.DataBindings.Clear()
brCode.DataBindings.Add(New Binding("Text", ds.Tables(bsTableName2), "BranchCode"))
brName.DataBindings.Clear()
cboOrganization.DataBindings.Add(New Binding("SelectedValue", ds.Tables(bsTableName2), "OsID"))
cboOrganization.DataBindings.Clear()
brName.DataBindings.Add(New Binding("Text", ds.Tables(bsTableName2), "BranchName"))
bsOnlineYNCheckBox.DataBindings.Clear()
bsOnlineYNCheckBox.DataBindings.Add(New Binding("Checked", ds.Tables(bsTableName2), "OnLineBrYN"))
Catch ex As Exception
MessageBox.Show("Error No : " & Err.Number & vbCrLf _
& "Error : " & ex.Message & vbCrLf _
& "Source : " & Err.Source & vbCrLf _
, "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
In my above code, all the data gets bind except with:
cboOrganization.DataBindings.Add(New Binding("SelectedValue", ds.Tables(bsTableName2), "OsID"))
cboOrganization.DataBindings.Clear()
Cany anyone tell me, why its not working?