I have got this piece of code: -
Dim Ctrl As Control
-
If Ctrl.ControlType = acCheckBox Then
-
my question is when i try to reference Ctrl, i dont get an property box poped up - seems like Ctrl of Control type hasn't got any property called .ControlType - but the above code still works and i get no error !
is that property hidden somewhere.. are there any hidden properties at all?
6 2046
I have got this piece of code: -
Dim Ctrl As Control
-
If Ctrl.ControlType = acCheckBox Then
-
my question is when i try to reference Ctrl, i dont get an property box poped up - seems like Ctrl of Control type hasn't got any property called .ControlType - but the above code still works and i get no error !
is that property hidden somewhere.. are there any hidden properties at all?
Well, not all properties are popped up in vb editor (not just the hidden ones).
To see hidden properties, go to Object Browser and check the "Show Hidden Members" option from the right click popup menu.
I have got this piece of code: -
Dim Ctrl As Control
-
If Ctrl.ControlType = acCheckBox Then
-
my question is when i try to reference Ctrl, i dont get an property box poped up - seems like Ctrl of Control type hasn't got any property called .ControlType - but the above code still works and i get no error !
is that property hidden somewhere.. are there any hidden properties at all?
You have declared an Object Variable As Type Control, but you have not explicitly assigned it to an Object. Take a look at the following 2 code segments which work as they should.- Loop through all the Controls on a Form and if the Control is a Check Box, print out its Name:
- Dim Ctrl As Control
-
-
For Each Ctrl In Me.Controls
-
If Ctrl.ControlType = acCheckBox Then
-
Debug.Print Ctrl.Name
-
End If
-
Next
- Assign the Object Variable Ctrl to a Text Box named txtLastName and set its Background Color to a Random Number between 0 and 15 (possible values of QBColor() Function):
- Dim Ctrl As Control
-
Randomize
-
Set Ctrl = Me![txtLastName]
-
Ctrl.BackColor = QBColor(Int(Rnd * 16))
- Let me know how you make out.
ADezii
Thanks for the code.
but again, even this code:
Ctrl.BackColor <- - BackColor is not a property of Ctrl, howcome its working.
I dont understand very well what you mean by 'i have declared an Object Variable As Type Control but you have not explicitly assigned it to an Object' ...
Ctrl is itself an object, why would i assign it to any other object?
Thanks You have declared an Object Variable As Type Control, but you have not explicitly assigned it to an Object. Take a look at the following 2 code segments which work as they should.- Loop through all the Controls on a Form and if the Control is a Check Box, print out its Name:
- Dim Ctrl As Control
-
-
For Each Ctrl In Me.Controls
-
If Ctrl.ControlType = acCheckBox Then
-
Debug.Print Ctrl.Name
-
End If
-
Next
- Assign the Object Variable Ctrl to a Text Box named txtLastName and set its Background Color to a Random Number between 0 and 15 (possible values of QBColor() Function):
- Dim Ctrl As Control
-
Randomize
-
Set Ctrl = Me![txtLastName]
-
Ctrl.BackColor = QBColor(Int(Rnd * 16))
- Let me know how you make out.
ADezii
Thanks for the code.
but again, even this code:
Ctrl.BackColor <- - BackColor is not a property of Ctrl, howcome its working.
I dont understand very well what you mean by 'i have declared an Object Variable As Type Control but you have not explicitly assigned it to an Object' ...
Ctrl is itself an object, why would i assign it to any other object?
Thanks
- As you have displayed Ctrl, it is not an Object but a Object Variable pointing to an Object. The same concept as:
- Dim intCounter As Integer
intCounter is not an Integer, it is just a Variable assigned as Type Integer and as of now does not equal anything. - Once you assign Ctrl (Instantiate) to a specific Object, it not points to that Object as in:
- Dim Ctrl As Control
-
Set Ctrl = Me![txtLastName] 'points to Me![txtLastName]
- BackColor is a Property of Ctrl but your are just accessing it the wrong way and it has to do with the specific Property Type, for instance:
- Ctrl.Properties("BackColor") = vbRed 'works fine
- Some Properties can be accessed by using the Dot (.) Syntax (Built-in) while others must be accessed via the Properties Collection for the specific Object.
- It is, in fact, very confusing.
Hey ADezii
Thank you very much ! - As you have displayed Ctrl, it is not an Object but a Object Variable pointing to an Object. The same concept as:
- Dim intCounter As Integer
intCounter is not an Integer, it is just a Variable assigned as Type Integer and as of now does not equal anything. - Once you assign Ctrl (Instantiate) to a specific Object, it not points to that Object as in:
- Dim Ctrl As Control
-
Set Ctrl = Me![txtLastName] 'points to Me![txtLastName]
- BackColor is a Property of Ctrl but your are just accessing it the wrong way and it has to do with the specific Property Type, for instance:
- Ctrl.Properties("BackColor") = vbRed 'works fine
- Some Properties can be accessed by using the Dot (.) Syntax (Built-in) while others must be accessed via the Properties Collection for the specific Object.
- It is, in fact, very confusing.
Hey ADezii
Thank you very much !
You are quite welcome.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Navin |
last post by:
Ado Sort -Relate, Compute By, or Sort operations cannot be done on
column(s) whose key length is unknown or exceeds 10 KB.
hi,
guys
i have asp application running on iis 5.0 windows 2000
i use...
|
by: Cardman |
last post by:
Greetings,
I am trying to solve a problem that has been inflicting my self
created Order Forms for a long time, where the problem is that as I
cannot reproduce this error myself, then it is...
|
by: Ivan Debono |
last post by:
Hi,
I keep getting an Unknown runtime error on line 3 below:
1 If oField.Type <> 136 Then 'adChapter
2 If Right(oField.name, 3) = "_id" Then
3 For Each...
|
by: Lance |
last post by:
Hi,
Sorry for the confusing subject, but here is what I am after: I am using
the 'System.Drawing.FontStyle' object, and I would like the caller of the
function to be able to decide when calling...
|
by: Lars-Erik Aabech |
last post by:
Hi!
Guess it's my day again.. Tried to deploy a test release of a new asp.net
web today, and got a terrible error.
The web is running swell on three development computers, but when it's
copied...
|
by: Klaus Johannes Rusch |
last post by:
IE7 returns "unknown" instead of "undefined" when querying the type of
an unknown property of an object, for example
document.write(typeof window.missingproperty);
Has "unknown" been defined...
|
by: TARUN |
last post by:
Hello All,
I am facing problem regarding Atlas.
I have install the AtlasSetup.msi in my .NET framework 2.0, and i open
the new Atlas Website......
Let me first explain the my senario,
I...
|
by: nelsonivan |
last post by:
Hi,
i'm trying to reference some objects using reflection and Late Binding
accessing.
The Object API to his methods it's easy to understand, and it's as
"Object.Method" - aka....
|
by: omono84 |
last post by:
I know that this should be rather simple but i seem to be missing a step to get it to work. and have been unable to find a solution on the net.
The aim is that I click on the open button to find...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |