 |
iliekater Level: Master
 Registered: 04-02-2005 Posts: 123
|
How can I specify a control ?
Beware ! This is a tough one !
We know that in order not to write the whole name of a specific form , one can simply use :
Me.
My question is , can someone use something similar like that for a control ? For instance :
MeCtrl.Name = "Blabla"
MeCtrl.BackColour = 8544444
etc ?
Some may say that I can just use the
With ......
statement if I am so bored or even use the contol's name like this :
Text100.Text = "yahoooooo"
Text100.Caption = "Don't press me"
etc .
But the problem is that I have plenty of such controls in the form and I hate writting the same code behind each of them (that is at the event of clicking them) .
I wish there was a property something like "LastClickedControl" so that I could search every control on the form (For each ... In ...) and pick the last cklicked control ,, but unfortunatelly there isn't ...
|
|
27-11-2006 at 03:49 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 123
|
Re: How can I specify a control ?
I think I should specify a few more things , becouse the above may confuse someone . If it was just as simple as above , I could simply use :
For Each ctrl In MyForm.Controls
If ctrl = Image _'or what ever control am I looking for
And ctrl.Name = "BlaBlaBla" 'the specific controls of that type
Then
... code here ...
However , I want to extract something that is pecific to each control , and that is its name , which means I am not able to write a generic code . And in order to be honnest with you , here's what I am trying to do :
I have a form with lots Image controls on it . I want whenever I press (practically click) one of those Images , its name (the control's name) to be written in a text box . Has anyone any idea how I could do that ? I could use an array of controls and simply extract the control's Tag property , but since I am using VBA , I don't think something like that is possible ...
|
|
27-11-2006 at 04:06 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 123
|
Re: How can I specify a control ?
a) The contols' arrays indeed do not exist in VBA ...
b) The Me.ActiveControl property does exist in VBA , but cannot be applied on Image controls ...
c) I already used the devine loop code (OK , instead of Me. , I used the exact form's name becouse I intend to call the sub from a module) ...
Could you drop a few more points of meditation?
That's a joke ofcourse !
|
|
28-11-2006 at 09:25 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 123
|
Re: How can I specify a control ?
Well , I can't use anything else on AutoCAD , you see . Well , I can use DCL , but it hurts too much or Object DCL , but noone asures me that at the next AutoCAD's version it will still be supported ...
|
|
01-12-2006 at 09:51 PM |
|
|
|
|
 |
 |