multiple selection of listbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deegeorge
    New Member
    • Nov 2008
    • 58

    multiple selection of listbox

    Hi,
    I have one combobox that contains the employee names. And another is listbox that contains the designation group, when i am selecting one name., suppose i selected the name 'nancy' from combobox then in the designation group automatically the employee and software engineer need to be selected(becaus e nancy is an employee as well as a software engineer.)How is it possible and also i want to modify the designation group.suppose i want to change nancy from software engineer to tester.Pls reply fast its urgent

    With regards,
    Deepa
  • rpicilli
    New Member
    • Aug 2008
    • 77

    #2
    Hi there.

    Could you put your code here so we can help you?

    If you're able to select one item in listbox, this will be the same steps to select the second. The only need is to configure your Listbox to accept multiple items select.

    This is done in both design and running mode

    I hope this help but put your code to be analized.

    Rpicilli

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Hi Deepa,

      if you are using database all that can be filtered by using SQL queries and can also be updated to change group.

      Comment

      • deegeorge
        New Member
        • Nov 2008
        • 58

        #4
        I have posted my code below.

        Dim i, j As Integer
        For i = 0 To Lstbx_Group.Ite ms.Count - 1
        For j = 0 To DataSet1.Tables (1).Rows.Count - 1
        If DataSet1.Tables (1).Rows(0).Ite m(j).ToString = Lstbx_Group.Ite ms(i).Value Then
        Lstbx_Group.Ite ms(i).Select()
        End If
        Next
        Next


        I am getting exceptions at line 4 and line 5 of this code

        exception at line 4:
        An unhandled exception of type 'System.Missing MemberException ' occurred in Microsoft.Visua lBasic.dll
        Additional information: Public member 'Value' on type 'DataRowView' not found.

        exception at line 5:
        An unhandled exception of type 'System.Missing MemberException ' occurred in Microsoft.Visua lBasic.dll
        Additional information: Public member 'Select' on type 'DataRowView' not found.

        When I select a given employee, say 'Nancy' from a combobox I use a query to retrive all the designations for Nancy into a DataSet (DataSet1). Lstbx_Group is the list box which contains all the designations. In that list I want the designations of the employee 'Nancy' to be selected. Please could you help me achive this. Thanks in advance.

        Comment

        • smartchap
          New Member
          • Dec 2007
          • 236

          #5
          Iff the combobox and both listboxes (designation & Group) have same number of entries, in the click event of combobox & both list boxes you must write a code like this:
          Suppose an item in combobox is selected.
          Check its ItemNo.
          select (automatically highlight) same ItemNo in both listboxes.
          in this way in all the three boxes corresponding items get selected.

          To change / modify an item you may place three command buttons one each for three boxes. Clicking first it will check itemno of selected item in combobox and ask for a new name. Then replace the new item with old one (keeping ItemNo same) so that new item / changed item will be at replaced place.

          I think I am clear.

          Comment

          Working...