Why don't you use the mousedown and mouseup event ?
In the mousedown you set a switch to True to track the status of the mousedown event. In the mouseup event you can track this switch and execute your code from here.
An alternative might be to use another mouse-event to write your code into.
Heres the deal. I have a listbox with hundreds of items in it. When the user opens an existing record the associated items are selected within the listbox. What I am trying to do is lock the listbox so that the user doesn't accidently click on the listbox and deselect all of the selected items. The end users want the listbox locked so that the user will have to concouesly "unlock" the listbox before being able to select. My idea was to cancel the click event if a variable called Locked is set to true. The end user would be able to right click on the control and select "Unlock Control", setting the locked variable to false.
Locking the control doesn't work the same way as it used to in VB 6...
That is a good idea but there are two issues with this approach.
1. I get the error "Cannot call this method when selectionMode is SelectionMode.NONE." when I try to set the selectionmode to None. The break appears at the point of selectionmode change.
2. When the control is locked all of the items in the list appear as "System.Data.DataRowView". When I set the value to MultiExtended my values appear correctly.
How about a transparent picture box? Add a handler for right clicks to prompt the user for the unlock, then set the width to 0. re-lock it by setting the width to as wide as the list box.
-Rick
---------------------- If you're about to post an ASP.Net question,
please don't do it in the VB.Net forum
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.