VBA and List Box

1 Posts
1 Users
0 Likes
22 Views
f.cubattoli
(@f-cubattoliarcinfo-com)
Posts: 167
Reputable Member
Topic starter
 

Hello!

In this period I'm playing a lot with VBA.

I spent a lot of time for a stupid things: insert a List Box in a Mimic to use with VBA, and for this reason I want to share my conclusion here hoping that will be useful for someone in the future.

In PcVue you can mainly have 3 different types of List Box:

  • The one provided by Microsoft Common Controls (mscomctl.ocx / comctl32.ocx)
  • The old one provided by Microsoft Forms Controls 2.0 (fm20.dll)
  • The native Arc Informatique List Box

The first two can have these problems:

  • For Microsoft Common Controls: they 're available in the target PC only if the Visual Studio 6.0 Runtime are installed. And the 2nd problem is that these library doesn't works properly in Windows 8/8.1
  • The second one, fm20.dll, can cause an Exception in PcVue that produce a crash

So the good solution I found is to use the native ARC Informatique Item List (Insert -> List Box). But you have to remember that if you want to use this List Box with VBA you have to initialize, insert items, and then finish the data entry otherwise the strings will be displayed truncated.

This is a sample of VBA code:

Private Sub Text1_Click()

AIListBox1.Begin

AiListBox1.addItem "PIZZA","1"
AiListBox1.addItem "SPAGHETTI","2"

AiListBox1.End

Hoping that my experience is useful for someone, I take the opportunity to thanks Anthony, Nicolas D. and Emmanuel E. for his help during these days of sweat. :cheer:

 
Posted : 21/03/2014 3:33 pm