PDA

View Full Version : ListView control instead of ListBox ?



KevinBarnett
2004-09-23, 12:59 PM
Greetings,

I was using the DataGrid control to display database records in Acad's vba. BUT I hit control license problems and could not find a solution. I am busy changing the DataGrid to a normal ListBox BUT ListBox only supports column headers when the data source is Excel. On searching for assistance I came across Franks recommendation to use ListView instead of ListBox. Surely I would encounter license problems again if I use ListView - correct?

What do you use? (to display database records in an acad vba form)

Thanks,

Kevin.

degrawmd
2004-09-24, 05:32 AM
Many times I use the FlexGrid. It requires that you reference it, and if you distribute your application the MSFLXGRD.ocx file must be registered in the System32 folder of other machines, but there is no licensing requirements for it.

mtuersley
2004-09-27, 03:16 AM
Actually, that is incorrect. None of the Microsoft grid controls may be used, distributed, or registered unless you have full VB. In VBA, you can only use those controls that appear in the toolbox with a clean install. No datagrids or other databound controls.

For other datagrids, look for a copy of BeeGrid or SGrid from vbAccelerator.com.

KevinBarnett
2004-09-27, 07:51 AM
Hi Mike,

SGrid - run-time errors?

I used regsvr32.exe to register -
vbalSGrid6.ocx
vbalIml6.ocx
SSubTmr6.dll

Then I started a new VBA project in acad 2005's vba. Added a form and inserted a vbalGrid control.

To test the grid I wrote this code:

Sub test()
With UserForm1.vbalGrid1
.AddColumn "Col1", "Col1"
.AddColumn "Col2", "Col2"
.AddColumn "Col3", "Col3"
.Rows = 1
.CellDetails 1, 1, "A"
.CellDetails 1, 2, "B"
.CellDetails 1, 3, "C"
End With

UserForm1.Show
End Sub

On running the sub the form displays correctly. But, when I close the form I get these error messages:

Run-time error '13', Type mismatch

Run-time error '0'

If I try to view the object in the VB Editor, after the error occurs, I get this error:
Run-time error '429', ActiveX component cannot create object

What am I missing?

Thanks,

Kevin.

mtuersley
2004-09-27, 02:11 PM
Hi Kevin,

I don't know what is happening. What else are you doing within the form? Are you clearing your objects whenever you exit? The code you posted is fine so it has to be between there and exiting.

If you want, post your entire project, or email it to me, and I'll check it out for you.

Mike

KevinBarnett
2004-09-28, 04:10 AM
VBA Project attached... BTW used the latest sgrid 2... going to try the older sgrid today...

mtuersley
2004-09-28, 04:41 AM
VBA Project attached... BTW used the latest sgrid 2... going to try the older sgrid today...

Hmmmm.....it could be a 2 issue. I'll have to download the latest and check. I used your code against 1.8 something.

degrawmd
2004-10-03, 07:45 AM
I've always had full versions of VB and now .Net and was ignorant to the the restriction with VBA.
Thanks for clarifying that.