Results 1 to 2 of 2

Thread: listbox

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Lebanon,Beirut
    Posts
    48

    listbox

    hi , i have a table containing the employee code and the employee name, i need a listbox showing at run time only the employee name and when selected the employee code shld b retreived! is there a way i can fill the list box with the employee code without beeing visible...
    thank you
    There is,we are,abou il zoulouf,mijana w mal3ona

  2. #2
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    First of all use a dataset to connect to the database.

    Second, set the listbox datasource and display member to appropriate values,

    Third add this code to your event:

    Where dsEmployeeInformation is your datasets name

    lstUsername is your listbox name

    And assuming you have a column named "Employee Code"in your datatable.



    Code:
      With dsEmployeeInformation.Employee_Information
                MessageBox.Show(Convert.ToString(.Rows(lstUsername.SelectedIndex)("Employee Code")))
            End With

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width