How to hanlde ListBox double click event

  • Thread starter Thread starter masani paresh
  • Start date Start date
M

masani paresh

Hi Friends,

I want to handle double click event on ListBox selected item so that it
should get invoked when user double clicked on some item. Also please let me
know how to get which item has been selected.

The following method is not working:

Sub ListBox1_DoubleClick
MsgBox "Double clicked"
End Sub

Thanks,
Paresh
 
Most controls placed on an Outlook form will only fire one event, even if
they expose additional events in their object model. In the case of a list
box you get the Click() event. If a multi-select list box you don't even get
that.

You read the selected value by looking at the Value property of that
control. You can also handle the Item.CustomPropertyChange() to find when a
bound list box value changes.
 
Ok Ken, I have added one more button to get the selected value. But none of
following working

MsgBox Item.GetInspector.ModifiedFormPages("Find Conference
Room").Controls("ListBox1").Items.Count

MsgBox Item.GetInspector.ModifiedFormPages("Find Conference
Room").Controls("ListBox1").SelectedItem.Value

Could you tell me whats the wrong here.

Thanks,
Paresh
 
Considering that a list box from MS Forms doesn't have either a SelectedItem
or Items property I can see why neither would work.

You really want to get in the habit of using the Object Browser in the
Outlook VBA project to see what properties, methods and events are available
on any object you want to use. The forms designer object browser is useless
for that. If you add a reference to MS Forms 2.0 to your Outlook VBA project
references you can then select that library in the VBA Object Browser and
select ListBox and see what's available to you.

The ListBox.List property gives you access to the list of items in the
ListBox. ListBox.Value gives you the selected value, as I mentioned before.
 
Back
Top