MarkItZero
Active member
Combo Boxes
Hello,
I have two combo boxes on a form. One combo box contains UserNames, the second combo box contains the JobNames that have been assigned to each User. When the form loads, the first UserName is displayed in CmboUserName and the first JobName for that User is displayed in CmboJobNames. However, I cant seem to get CmboJobNames to properly refresh when a different UserName is selected. Here is the code I have now...
Any Suggestions?
Thanks!
Hello,
I have two combo boxes on a form. One combo box contains UserNames, the second combo box contains the JobNames that have been assigned to each User. When the form loads, the first UserName is displayed in CmboUserName and the first JobName for that User is displayed in CmboJobNames. However, I cant seem to get CmboJobNames to properly refresh when a different UserName is selected. Here is the code I have now...
Code:
Fill CmboUserName
Fill DSUsers1 Dataset
OleDbDataAdapter2.Fill(DsViewOthersUserName1, "Users")
Create Dataview
Dim dm As DataTable = DsViewOthersUserName1.Tables("Users")
Dim DVCmboUserName As DataView = New DataView(dm)
DVCmboUserName.RowFilter = "UserName <> " & CurrentUser & ""
Populate Combo Box
CmboUserName.DataSource = DVCmboUserName
CmboUserName.DisplayMember = "UserName"
Fill CmboJobName
FillCmboJobName(CmboUserName.Text)
End Sub
CmboUserName Index Change
Private Sub CmboUserName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmboUserName.SelectedIndexChanged
Refresh CmboJobName
FillCmboJobName(CmboUserName.Text)
End Sub
Sub FillCmboJobName(ByVal UserName As String)
Fill CmboJobName
Fill DSUsers1 Dataset
OleDbDataAdapter1.Fill(DsViewOthersJobName1, "EstHeader")
Create Dataview
Dim dm2 As DataTable = DsViewOthersJobName1.Tables("EstHeader")
Dim DVCmboJobName As DataView = New DataView(dm2)
DVCmboJobName.RowFilter = "UserName = " & UserName & ""
Populate Combo Box
CmboJobName.DataSource = DVCmboJobName
CmboJobName.DisplayMember = "Job"
End Sub
Any Suggestions?
Thanks!
Last edited by a moderator: