Existential question!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anil Gupte

    #1

    Existential question!

    As in "Who am I?" or better "Who am Me?"

    When I use:
    Dim X0 As Integer = ActiveForm.Loca tion.X

    Dim Y0 As Integer = ActiveForm.Loca tion.Y

    Dim strTest As String = ActiveForm.Name

    Dim SIX0 = X0 + 560

    Dim SIY0 = Y0 - 30

    The strTest variable contains the name of the container form (the
    MDIParent). However, when I do this:

    Dim X0 As Integer = Me.Location.X

    Dim Y0 As Integer = Me.Location.Y

    Dim strTest As String = Me.Name

    Dim SIX0 = X0 + 560

    Dim SIY0 = Y0 - 30

    I get the name of the form within the container (called FormMain). More
    important the locations seem to be all messed up. When I use Me.Location,
    the 0,0 point is not the topleft of the form, I have to use the negative
    value to try to position some test at the top.

    Any advice?

    Thanx,
    --
    Anil Gupte
    Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

    www.icinema.com


  • Anil Gupte

    #2
    Re: Existential question!

    I forgot to add, my FormMain (dimmed as frmMain) refuses to fill up the
    Container i.e. the MDIParent until I switch to another form and then come
    back. In the Container form I do have:
    Private Sub FormContainer_L oad(ByVal sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    frmMain.MdiPare nt = Me

    frmSliceInfo.Md iParent = Me

    frmSliceInfo.Do ck = DockStyle.Fill

    frmMain.Dock = DockStyle.Fill

    frmMain.Show()

    End Sub

    and I have also set the Dock property in the properties window of all the
    forms to "None".
    --
    Anil Gupte
    Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

    www.icinema.com

    "Anil Gupte" <anil-list@icinema.co mwrote in message
    news:u0uv0ce%23 GHA.4388@TK2MSF TNGP02.phx.gbl. ..
    As in "Who am I?" or better "Who am Me?"
    >
    When I use:
    Dim X0 As Integer = ActiveForm.Loca tion.X
    >
    Dim Y0 As Integer = ActiveForm.Loca tion.Y
    >
    Dim strTest As String = ActiveForm.Name
    >
    Dim SIX0 = X0 + 560
    >
    Dim SIY0 = Y0 - 30
    >
    The strTest variable contains the name of the container form (the
    MDIParent). However, when I do this:
    >
    Dim X0 As Integer = Me.Location.X
    >
    Dim Y0 As Integer = Me.Location.Y
    >
    Dim strTest As String = Me.Name
    >
    Dim SIX0 = X0 + 560
    >
    Dim SIY0 = Y0 - 30
    >
    I get the name of the form within the container (called FormMain). More
    important the locations seem to be all messed up. When I use Me.Location,
    the 0,0 point is not the topleft of the form, I have to use the negative
    value to try to position some test at the top.
    >
    Any advice?
    >
    Thanx,
    --
    Anil Gupte
    Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

    www.icinema.com
    >
    >

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Existential question!

      Anil,

      Me is the same as in the C languages "this".

      It means all the variables (objects values) that are in the object from the
      class itself.

      me.textBox1 is the same as textbox1.

      It is easy however if you don't remember a name to type first me.

      It is also easy to tell to another object which object is the sender,

      The problem is that you are not telling what kind of form you are using, it
      can by instance be a MDI, a showdialog or something used as a usercontrol
      inside your control container.

      Cor

      "Anil Gupte" <anil-list@icinema.co mschreef in bericht
      news:u0uv0ce%23 GHA.4388@TK2MSF TNGP02.phx.gbl. ..
      As in "Who am I?" or better "Who am Me?"
      >
      When I use:
      Dim X0 As Integer = ActiveForm.Loca tion.X
      >
      Dim Y0 As Integer = ActiveForm.Loca tion.Y
      >
      Dim strTest As String = ActiveForm.Name
      >
      Dim SIX0 = X0 + 560
      >
      Dim SIY0 = Y0 - 30
      >
      The strTest variable contains the name of the container form (the
      MDIParent). However, when I do this:
      >
      Dim X0 As Integer = Me.Location.X
      >
      Dim Y0 As Integer = Me.Location.Y
      >
      Dim strTest As String = Me.Name
      >
      Dim SIX0 = X0 + 560
      >
      Dim SIY0 = Y0 - 30
      >
      I get the name of the form within the container (called FormMain). More
      important the locations seem to be all messed up. When I use Me.Location,
      the 0,0 point is not the topleft of the form, I have to use the negative
      value to try to position some test at the top.
      >
      Any advice?
      >
      Thanx,
      --
      Anil Gupte
      Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

      www.icinema.com
      >
      >

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Existential question!

        Anil,

        I was quick starting, if it is a MDI, you can always find the parent in the
        MDI parent property from a child and the childs in the MDIchildren
        collection (just looping).

        http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

        Cor

        "Anil Gupte" <anil-list@icinema.co mschreef in bericht
        news:OHFYyke%23 GHA.4544@TK2MSF TNGP05.phx.gbl. ..
        >I forgot to add, my FormMain (dimmed as frmMain) refuses to fill up the
        >Container i.e. the MDIParent until I switch to another form and then come
        >back. In the Container form I do have:
        Private Sub FormContainer_L oad(ByVal sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        >
        frmMain.MdiPare nt = Me
        >
        frmSliceInfo.Md iParent = Me
        >
        frmSliceInfo.Do ck = DockStyle.Fill
        >
        frmMain.Dock = DockStyle.Fill
        >
        frmMain.Show()
        >
        End Sub
        >
        and I have also set the Dock property in the properties window of all the
        forms to "None".
        --
        Anil Gupte
        Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

        www.icinema.com
        >
        "Anil Gupte" <anil-list@icinema.co mwrote in message
        news:u0uv0ce%23 GHA.4388@TK2MSF TNGP02.phx.gbl. ..
        >As in "Who am I?" or better "Who am Me?"
        >>
        >When I use:
        >Dim X0 As Integer = ActiveForm.Loca tion.X
        >>
        >Dim Y0 As Integer = ActiveForm.Loca tion.Y
        >>
        >Dim strTest As String = ActiveForm.Name
        >>
        >Dim SIX0 = X0 + 560
        >>
        >Dim SIY0 = Y0 - 30
        >>
        >The strTest variable contains the name of the container form (the
        >MDIParent). However, when I do this:
        >>
        >Dim X0 As Integer = Me.Location.X
        >>
        >Dim Y0 As Integer = Me.Location.Y
        >>
        >Dim strTest As String = Me.Name
        >>
        >Dim SIX0 = X0 + 560
        >>
        >Dim SIY0 = Y0 - 30
        >>
        >I get the name of the form within the container (called FormMain). More
        >important the locations seem to be all messed up. When I use
        >Me.Location, the 0,0 point is not the topleft of the form, I have to use
        >the negative value to try to position some test at the top.
        >>
        >Any advice?
        >>
        >Thanx,
        >--
        >Anil Gupte
        >www.keeninc.net
        >www.icinema.com
        >>
        >>
        >
        >

        Comment

        • Anil Gupte

          #5
          Re: Existential question!

          I am sorry, I did not understand your response. First of all why does it
          (fmrMain) not fill up the container form? The other form (frmSliceInfo)
          does, and all the parameters are the same. Also, why is Me not the same as
          ActiveForm?

          --
          Anil Gupte
          Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

          www.icinema.com

          "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
          news:%23Oa8Eue% 23GHA.4800@TK2M SFTNGP05.phx.gb l...
          Anil,
          >
          I was quick starting, if it is a MDI, you can always find the parent in
          the MDI parent property from a child and the childs in the MDIchildren
          collection (just looping).
          >
          http://msdn2.microsoft.com/en-us/lib...ichildren.aspx
          >
          Cor
          >
          "Anil Gupte" <anil-list@icinema.co mschreef in bericht
          news:OHFYyke%23 GHA.4544@TK2MSF TNGP05.phx.gbl. ..
          >>I forgot to add, my FormMain (dimmed as frmMain) refuses to fill up the
          >>Container i.e. the MDIParent until I switch to another form and then come
          >>back. In the Container form I do have:
          >Private Sub FormContainer_L oad(ByVal sender As System.Object, ByVal e As
          >System.EventAr gs) Handles MyBase.Load
          >>
          >frmMain.MdiPar ent = Me
          >>
          >frmSliceInfo.M diParent = Me
          >>
          >frmSliceInfo.D ock = DockStyle.Fill
          >>
          >frmMain.Dock = DockStyle.Fill
          >>
          >frmMain.Show ()
          >>
          >End Sub
          >>
          >and I have also set the Dock property in the properties window of all the
          >forms to "None".
          >--
          >Anil Gupte
          >www.keeninc.net
          >www.icinema.com
          >>
          >"Anil Gupte" <anil-list@icinema.co mwrote in message
          >news:u0uv0ce%2 3GHA.4388@TK2MS FTNGP02.phx.gbl ...
          >>As in "Who am I?" or better "Who am Me?"
          >>>
          >>When I use:
          >>Dim X0 As Integer = ActiveForm.Loca tion.X
          >>>
          >>Dim Y0 As Integer = ActiveForm.Loca tion.Y
          >>>
          >>Dim strTest As String = ActiveForm.Name
          >>>
          >>Dim SIX0 = X0 + 560
          >>>
          >>Dim SIY0 = Y0 - 30
          >>>
          >>The strTest variable contains the name of the container form (the
          >>MDIParent). However, when I do this:
          >>>
          >>Dim X0 As Integer = Me.Location.X
          >>>
          >>Dim Y0 As Integer = Me.Location.Y
          >>>
          >>Dim strTest As String = Me.Name
          >>>
          >>Dim SIX0 = X0 + 560
          >>>
          >>Dim SIY0 = Y0 - 30
          >>>
          >>I get the name of the form within the container (called FormMain).
          >>More important the locations seem to be all messed up. When I use
          >>Me.Location , the 0,0 point is not the topleft of the form, I have to use
          >>the negative value to try to position some test at the top.
          >>>
          >>Any advice?
          >>>
          >>Thanx,
          >>--
          >>Anil Gupte
          >>www.keeninc.net
          >>www.icinema.com
          >>>
          >>>
          >>
          >>
          >
          >

          Comment

          • Theo Verweij

            #6
            Re: Existential question!

            Thre is one difference: frmMain is shown during the load event of the
            mdiform. Try loading frmMain after the mdi form is fully loaded.

            Me is the instance you are currently in (if frmMaincode, me means
            frmmain, in frmSliceInfo code, me means frmSliceInfo).
            ActiveForm is the activeform of the project.

            So to see the difference:

            'code in frmSliceInfo, which is active
            frmMain.mySub 'calls a routine in frmMain


            'code in frmMain:
            Public Sub mySub()
            'When called from above
            'Me is frmMain
            'ActiveForm is frmSliceInfo

            'When called when frmMain is active
            'Me is still frmMain
            'ActiveForm is now also frmMain
            End Sub


            Anil Gupte wrote:
            I am sorry, I did not understand your response. First of all why does it
            (fmrMain) not fill up the container form? The other form (frmSliceInfo)
            does, and all the parameters are the same. Also, why is Me not the same as
            ActiveForm?
            >

            Comment

            • Anil Gupte

              #7
              Re: Existential question!

              How do I load frmMain after the MDI container is loaded? There is no other
              event I can call as far as I know. I may have fixed the problem though by
              adding the line:
              frmMain.Size = Me.Size

              to the Private Sub FormContainer_L oad event

              Thanx for the input.
              --
              Anil Gupte
              Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

              www.icinema.com


              "Theo Verweij" <tverweij@xs4al l.nlwrote in message
              news:ORrI4Cf%23 GHA.3456@TK2MSF TNGP02.phx.gbl. ..
              Thre is one difference: frmMain is shown during the load event of the
              mdiform. Try loading frmMain after the mdi form is fully loaded.
              >
              Me is the instance you are currently in (if frmMaincode, me means frmmain,
              in frmSliceInfo code, me means frmSliceInfo).
              ActiveForm is the activeform of the project.
              >
              So to see the difference:
              >
              'code in frmSliceInfo, which is active
              frmMain.mySub 'calls a routine in frmMain
              >
              >
              'code in frmMain:
              Public Sub mySub()
              'When called from above
              'Me is frmMain
              'ActiveForm is frmSliceInfo
              >
              'When called when frmMain is active
              'Me is still frmMain
              'ActiveForm is now also frmMain
              End Sub
              >
              >
              Anil Gupte wrote:
              >I am sorry, I did not understand your response. First of all why does it
              >(fmrMain) not fill up the container form? The other form (frmSliceInfo)
              >does, and all the parameters are the same. Also, why is Me not the same
              >as ActiveForm?
              >>

              Comment

              • Theo Verweij

                #8
                Re: Existential question!

                Or use frmMain.windows tate = FormWindowState .Maximized instead of the
                dock property - It seems this is what you want after all.

                Anil Gupte wrote:
                How do I load frmMain after the MDI container is loaded? There is no other
                event I can call as far as I know. I may have fixed the problem though by
                adding the line:
                frmMain.Size = Me.Size
                >
                to the Private Sub FormContainer_L oad event
                >
                Thanx for the input.

                Comment

                Working...