Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default creating controls at runtime

Is there a way to create an array of controls during
runtime? The program I'm developing will compare 2 files
and put discrepancies in a listbox. For each entry, I
would like a checkbox developed (preferably in the listbox
though I don't think that's possible) The user can then
checkmark the discrepancies he/she wants to update. The
amount of entries in the listbox (and the number of
checkboxes) will vary each time the program is run.

Also, related: is there a way to grid out the listbox to
show multiple rows and columns? (making it look similar
to an excel spreadsheet)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default creating controls at runtime

The normal ListBox will solve both questions
- to get the checkboxes, set the ListStyle to
fmListStyleOption
- to allow multiple selections, set MultiSelect to
fmMultiSelectMulti
- to get multiple columns, set ColumnCount to the number
you need
-- to add an entry, use something like..
With Me.lbxCompare
.AddItem value_1
.List(.ListCount -1, 1) = value_2
.List(.ListCount -1, 2) = value_3
End With

- note that List is dimensioned from 0 across and down
- to determine whether a line is checked then use

With Me.lbxCompare
For ndex = 0 to .ListCount - 1
If .Selected(ndex) Then
'do something about it
End
Next ndex
End With

Kevin Beckham

-----Original Message-----
Is there a way to create an array of controls during
runtime? The program I'm developing will compare 2 files
and put discrepancies in a listbox. For each entry, I
would like a checkbox developed (preferably in the

listbox
though I don't think that's possible) The user can then
checkmark the discrepancies he/she wants to update. The
amount of entries in the listbox (and the number of
checkboxes) will vary each time the program is run.

Also, related: is there a way to grid out the listbox to
show multiple rows and columns? (making it look similar
to an excel spreadsheet)
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default creating controls at runtime

Hi Kevin,
Great code! Just let you know a typing error. :-)
Change "End" before "Next ndex" to "End If".

Colo

"Kevin Beckham" wrote in message
...
The normal ListBox will solve both questions
- to get the checkboxes, set the ListStyle to
fmListStyleOption
- to allow multiple selections, set MultiSelect to
fmMultiSelectMulti
- to get multiple columns, set ColumnCount to the number
you need
-- to add an entry, use something like..
With Me.lbxCompare
.AddItem value_1
.List(.ListCount -1, 1) = value_2
.List(.ListCount -1, 2) = value_3
End With

- note that List is dimensioned from 0 across and down
- to determine whether a line is checked then use

With Me.lbxCompare
For ndex = 0 to .ListCount - 1
If .Selected(ndex) Then
'do something about it
End
Next ndex
End With

Kevin Beckham

-----Original Message-----
Is there a way to create an array of controls during
runtime? The program I'm developing will compare 2 files
and put discrepancies in a listbox. For each entry, I
would like a checkbox developed (preferably in the

listbox
though I don't think that's possible) The user can then
checkmark the discrepancies he/she wants to update. The
amount of entries in the listbox (and the number of
checkboxes) will vary each time the program is run.

Also, related: is there a way to grid out the listbox to
show multiple rows and columns? (making it look similar
to an excel spreadsheet)
.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Sundowner Excel Discussion (Misc queries) 0 February 27th 10 01:31 AM
Runtime error aftamath77 Excel Discussion (Misc queries) 8 October 15th 08 10:46 PM
Creating controls to autofill a form wepstech Excel Discussion (Misc queries) 2 February 23rd 07 01:00 PM
Assigning events to runtime-created controls - is it possible? BizMark Excel Discussion (Misc queries) 1 November 20th 06 09:36 AM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM


All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"