Re: CORRECTED TEST AND ANSWERS.

Tech-Archive recommends: Fix windows errors by optimizing your registry



: What is wrong with this code?
:
: Dim s as String
: s = "Test"
: MyFunction n
: ...
: Private Function MyFunction(byval nVar as integer) as integer
: <Do something fun>
: End Function
:

Actually you get variable not defined, as I suspect you meant to pass 's' as
the parameter, and not n which is now undeclared.

------------------
What is wrong with this code?

Private Sub MySub(byval nMat as integer) as long

---ANSWER
A Sub cannot have a return value.


A better (more accurate) answer is "A sub does not return a value".


-----------------

A form is Unloaded specifically set to Nothing while one control on it is
still referenced somewhere. What will happens?

---ANSWER
The form will be reloaded the instant that control is actively
referenced and will be loaded with default values instead of the
last values it contained.


To me you're missing the point with this question. Controls don't have
references per se; what you are saying is any reference to a control on the
form (execution of a control's property) will cause the reload. The question
would be better as: "A form has been Unloaded and set to Nothing. What will
happen if a property of one of that form's controls is now referenced in
code?" And the



------------------


Here's another one ...

What does n hold after executing this code?

n = DoEvents()

Answer: the number of currently open forms in the application.

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
----------------------------------------------------------------------------
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
----------------------------------------------------------------------------




.



Relevant Pages

  • Re: basic control reference syntax
    ... > property is not available unless the control has the focus. ... >> Private Sub SetEmail() ... >> Private Function isTextBoxEmptyAs Boolean ...
    (microsoft.public.access.forms)
  • Re: Reference Error
    ... Try "refreshing" your references. ... know what a "control" is. ... The line that is highlighted is a sub definition. ...
    (comp.databases.ms-access)
  • Re: CORRECTED TEST AND ANSWERS.
    ... Private Function MyFunctionas integer ... >A Sub cannot have a return value. ... >A form is Unloaded specifically set to Nothing while one control on it is ... >references per se; what you are saying is any reference to a control on the ...
    (microsoft.public.vb.general.discussion)
  • Re: Reference Error
    ... know what a "control" is. ... The line that is highlighted is a sub definition. ... I think there has to be some default references that have gotten ... HTH - RuralGuy acXP WinXP Pro ...
    (comp.databases.ms-access)
  • RE: Built in function errors.
    ... I have yet to work with 2007 and certainly not in a mixed environment. ... I've replaced UCase intrinsic function located in the Control ... ways of trying to match all the libraries but so far nothing has worked 100%. ... It is probably that these issues are not related to references. ...
    (microsoft.public.access.modulesdaovba)