Hello,
It seems like something simple but I'm still not really able to figure this out.
How can I select a lisbox's item by right-clicking on it?
Thanks in advance for any inputs!
Best regard,
VBNex.
5 2674
Hello,
It seems like something simple but I'm still not really able to figure this out.
How can I select a lisbox's item by right-clicking on it?
Thanks in advance for any inputs!
Best regard,
VBNex.
On the MouseDown, Mouseup event you can check for which button. If Button 2 do something
Hello,
Thanks a lot for your answer.
Button number 2,I know but my question was...
What's the code to make the 2nd (right-click) work like the 1st (left mouse button) (To "highlight"/select the entry)?
Thanks!
I would like to know that too!!
I would like to know that too!!
hi
i might have a solution -
-
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
-
-
Private Const LB_ITEMFROMPOINT = &H1A9
-
Dim ndx as Long
-
-
-
-
Public Function ListBoxHit(ListBox As ListBox, ByVal X As Single, ByVal Y As Single) As Long
-
-
ndx= SendMessage(YourListBox.hWnd, LB_ITEMFROMPOINT, 0, (Y \ Screen.TwipsPerPixelY) * 65536 + (X \ Screen.TwipsPerPixelX))
-
If (ndxAnd &H10000) = &H10000 Then
-
ListBoxHit = -1
-
Else
-
ListBoxHit = ndx
-
End If
-
End Function
-
-
-
Private Sub YourListBox_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
-
-
If Button = 2 Then
-
ndx= ListBoxHit(YourListBox, X, Y)
-
If Not ndx= -1 Then YourListBox.Selected(ndx) = True
-
End If
-
End Sub
-
-
similar your may alter _mousedown by _mousemove !
:)
Use the HitTest method: - Private Sub ListView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseUp
-
Dim hti As ListViewHitTestInfo = ListView1.HitTest(e.Location)
-
Dim six As Integer = hti.Item.SubItems.IndexOf(hti.SubItem)
-
MsgBox(six.ToString)
-
End Sub
i didn't test out this exact code, so it might not work exactly, but I know it's this method you want to be using.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrea |
last post by:
Hi,
I'm trying to emulate part of our client-server application as a web
site so customers can use it, and I'm stuck when it comes to
re-ordering items in a list.
Basically we have a list of...
|
by: Adrian |
last post by:
This script works well for searching thru a SELECT list but doesnt work so
well with the MULTIPLE option. I need to modify it to work for a SELECT
MULTIPLE but I have no idea where to begin, any...
|
by: headware |
last post by:
I have a <select> control that contains many entries. It allows the
user to multi-select a group of them, click a button, and store the
selected data in a database. Normally they do this starting...
|
by: William Wisnieski |
last post by:
Hello Everyone,
I have a main form with a datasheet subform that I use to query by form.
After the user selects two criteria on the main form and clicks the
cmdShowResults button on the main...
|
by: Chris Fink |
last post by:
Does anyone know it is possible to include a small image(.gif .jpeg)
within a <SELECT><option> so that the user would see the option text as
well as a little image(icon) in the option? I know this...
| |
by: akameswaran |
last post by:
I have a list box, I'd like to generate a right click menu for items in
the list box. The problem is unless I left click the item first, I
can't figure out which item in the list I clicked over. ...
|
by: Bubba |
last post by:
I have a dynamic pulldown list (ASP with javascript) that when a user
picks a state, the corresponding counties for that state appear in a
dynamic second pulldown list. When I submit the form, the...
|
by: The.Daryl.Lu |
last post by:
Hi, two parts to my problem if someone can help address either one or
both:
1. I want to SELECT everything in the table if it matches the
criteria when the query button is pressed (this is just...
|
by: Sunray |
last post by:
I have a form called the sales form and i have 2 sets of listboxes
So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |