Results 1 to 2 of 2

Thread: [02/03] Listbox questions

  1. #1

    Thread Starter
    Addicted Member JuzMe's Avatar
    Join Date
    Jul 2006
    Posts
    209

    [02/03] Listbox questions

    I was wondering when I select a row in listbox1, how do I automatically select a row in listbox2 too?

    Another question is how do I allow 2 fields of my database to be populated to my listbox? Example modulecode and modulename values are shown in listbox.
    I tried using this code but it did not work. I am certain that the modulecode is the first and primary key column.

    VB Code:
    1. Dim cap As New CAPS_BIZ1.Service1
    2.  
    3.                 ListBox1.DataSource = cap.populateAssignedData()
    4.        
    5.  
    6.         ListBox1.DataTextField = "modulecode"
    7.         ListBox1.DataValueField = "modulename"
    8.  
    9.         ListBox1.DataBind()

    What should I do?
    I am such a VB.NET 2005 idiot. Sorry If I don't even know basic stuff.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: [02/03] Listbox questions

    #1Q
    Set the first listbox autopostback to True , double click listbox 1 , enter this code


    this.ListBox2.SelectedIndex = this.ListBox1.SelectedIndex;

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