Closed Thread
Results 1 to 3 of 3

Thread: ListBox select item by right-clicking

  1. #1
    Jordan Guest

    ListBox select item by right-clicking

    Here is how to select an item in a listbox when right-clicking:

    C++
    Code:
    private: System::Void listBox1_MouseDown(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
              if (e->Button == System::Windows::Forms::MouseButtons::Right) {
              listBox1->SelectedIndex = listBox1->IndexFromPoint(e->X, e->Y);
     }
    					
    			 }
    C#
    Code:
    private void LST_BX_MouseDown(object sender, MouseEventArgs e) {
       if(e.Button == MouseButtons.Right)
          LST_BX.SelectedIndex = LST_BX.IndexFromPoint(e.X, e.Y);
    }

  2. CODECALL Circuit advertisement

     
  3. #2
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    Nice code. I've never really thought about right-clicking and selecting. It seems like a feature that should already be imbedded int he code.

  4. #3
    Void's Avatar
    Void is offline Programming Expert
    Join Date
    Jun 2006
    Posts
    410
    Rep Power
    23
    You would think this would be default code.....
    Void

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to select data of a select list from database table
    By justsachin4u in forum PHP Development
    Replies: 26
    Last Post: 07-10-2011, 12:34 AM
  2. How to Select data of a select list from database???
    By justsachin4u in forum PHP Development
    Replies: 0
    Last Post: 06-25-2011, 04:58 AM
  3. How to Select data of a select list from database???
    By justsachin4u in forum PHP Development
    Replies: 0
    Last Post: 06-25-2011, 04:49 AM
  4. listbox how select index
    By mokszyk in forum C# Programming
    Replies: 3
    Last Post: 07-21-2010, 11:48 AM
  5. Possible to tag a value onto a listbox item?
    By 2710 in forum Pascal and Delphi
    Replies: 12
    Last Post: 02-16-2010, 01:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

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