Note that there are some explanatory texts on larger screens.

plurals
  1. PODrop Down in VB.NET
    primarykey
    data
    text
    <p>I have a small requirement and that is: </p> <p>There are two combo boxes on a form and for populating the employee names and roles. I am populating the combo boxes as follows: </p> <ol> <li><p>I have created a class called "DbConnect" and in that there are 02 functions as: </p> <pre><code>Public Function getEmployees() As DataTable Dim employeeDS As New DataSet Dim employeeDA As New SqlDataAdapter("prc_emp_list", conn) employeeDA.Fill(employeeDS, "employees") Return employeeDS.Tables("employees") End Function Public Function getRoles() As DataTable Dim roleDS As New DataSet Dim roleDA As New SqlDataAdapter("prc_role_list", conn) roleDA.Fill(roleDS, "roles") Return roleDS.Tables("roles") End Function </code></pre></li> <li><p>Have designed a form with two combo boxes and am populating data into them as: </p> <pre><code>Public Sub employees() accessFunction.Open() cboEmployees.DataSource = accessFunction.getEmployees cboEmployees.DisplayMember = "emp_name" cboEmployees.ValueMember = "login_id" End Sub Public Sub roles() accessFunction.Open() cboRoles.DataSource = accessFunction.getRoles cboRoles.DisplayMember = "role_name" cboRoles.ValueMember = "role_id" End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load employees() roles() End Sub </code></pre></li> </ol> <p>The data is getting populated into the combo boxes correctly and my requirement is that when I select and employee from the first combo, his corresponding role should get selected in the second combo.</p> <p>Anyone, please help me on this requirement. </p> <p>Regards,<br> George </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload