Results 1 to 7 of 7

Thread: Unexpected result (Resolved)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Unexpected result (Resolved)

    Hi,

    While trying to identify a problem I have with a project, I happened, at a breakpoint, to try to print in the command window, the name of the current form.

    I had created frmMain as an instance of fclsMain and to my surprise, the command window showed "fclsMain".

    I expected it to show "frmMain".

    Can anyone explain, please?
    Last edited by taxes; Mar 1st, 2004 at 11:49 AM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    What did you use in the command window?

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    "What did you use in the command window?"

    VB Code:
    1. ? me.name
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Is frmMain the variable name? Me.Name will return whatever is set as in the Name property.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    "Is frmMain the variable name? Me.Name will return whatever is set as in the Name property."

    frmMain is the instance of fclsMain

    Are you saying that frmName.Name will hold the same contents as fclsMain.Name? If so, why do I refer to objects in frmMain as, eg. "frmMain.txtOne" ?
    Last edited by taxes; Mar 1st, 2004 at 04:13 AM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    If frmMain is an instance of fclsMain and fclsMain has the name set at designtime then frmMain will have the same name as what was set at designtime. This is because the things you set at designtime are executed in the constructor of the object which gets called for every instance. So unless you change the name property at runtime then every instance of fclsMain will have the same name. The name is just a property like any other and has no bearing on how you refer to the object.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi Edneeis,


    Got it!

    Many thanks.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width