Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Need help with adding Controls and event handlers at runtime

I've gotten thus far that I've got a grid of 7x4 checkboxes and the
equal amount of labels that are being created while initiating my form.
Both resides in arrays. I've made a class module that is linked to the
checkboxes so that if one changes the value it triggers my
eventhandler. Now the problem is that while the excel runs the
eventhadler (one for all the checkboxes all togeather, which is sweet)
i can't as far as i can see access the individual checkboxes and labels
through their array reference

---
To explain it in terms of code I have an empty form that when initiaded
runs comands something like this
----

dim myChkBox (1 to 7, 1 to 4), myLabel(1 to 7, 1 to 4) as Control
dim i,j as integer
dim tempCB as clsCBEvents 'thats the name of my class module
dim CBcol as New Collection

for i = 1 to 7
for j = 1 to 4
Set myChkBox(i,j) = Frame1.Controls.Add("Forms.CheckBox.1",
"myCB" & i & j)
Set myChkBox(i,j) = Frame1.Controls.Add("Forms.Label.1", "myCB" &
i & j)
With myChkBox(i,j)
' First i set sizes and such (not included here)
set tempCB = new clsCVEvents
set tempCB.cb = myChkBox(i,j)
CBcol.add tempCB
next j
next i

----
now the class module named clsCVEvents
----

Public WithEvents cb As MSForms.CheckBox

Private Sub cb_Change()
'first i extract i and j from the last 2 positions through
activecontrol.name
'then i need to A) be able to change the properties of
myChkBox(i,j) and myLabel(i,j) oe
' B) be able to call a sub somewhere that might be able to
' or in any other way change the properties of those two
End Sub

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
Need help with adding Controls and event handlers at runtime [email protected] Excel Programming 0 December 27th 06 04:36 PM
Event Code for Controls created at runtime... Robert Bruce[_2_] Excel Programming 0 December 6th 06 12:11 PM
Event Code for Controls created at runtime... Bob Phillips Excel Programming 0 December 6th 06 10:35 AM
adding controls to userform at runtime Ouka[_12_] Excel Programming 3 August 18th 05 08:11 PM
add event to controls added in runtime Brotha lee Excel Programming 1 May 21st 05 10:32 AM


All times are GMT +1. The time now is 09:43 PM.

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"