Solved

Setting runtime form location

Posted on 2016-11-21
4
43 Views
Last Modified: 2016-11-21
hello,
How can I set location of the runtime created form below the mainform.
I have 5 runtime forms ,they need to be one below the other when created.


i have this bit of working vcode:

objfrm2 .Location = New Point(Me.Left, Me.Bottom + objFrm2.Height)

The 'Me' should be the last created form or the mainform ,need advise on the 'Me' part
Cheers
0
Comment
Question by:RIAS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
ste5an earned 250 total points
ID: 41895808
Use an director (see builder pattern). E.g. something like:

Public Class WindowManager
    Private forms As New List(Of Form)

    Public Sub AddForm(AForm As Form)
        Me.forms.Add(AForm)
    End Sub

    Public Sub ArrangeWindows()
        Dim currentTop As Long = 0

        For Each form As Form In Me.forms
            form.Location = New Point(form.Left, currentTop)
            currentTop += form.Height
        Next form
    End Sub
End Class

Open in new window

0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 250 total points
ID: 41895828
Me refers to the object the code is being run in.  eg.  The current instance of a form.  

Other objects would need to be qualified with code   eg.  frm1.xxxx, frm2.yyyy where frm1, frm2 are references to existing forms.
0
 

Author Comment

by:RIAS
ID: 41895857
Hello,
This is the code :

 Dim objFrm2 As New FrmInvoices(AddrowinForm, True)

            Me.StartPosition = FormStartPosition.Manual

            'Me.Location = New Point(30,
            '30)  'Screen.GetWorkingArea(Me).Location
            Me.Location = New Point((Screen.PrimaryScreen.WorkingArea.Width - Me.Width) \ 2, 0)

            With objFrm2
                .StartPosition = FormStartPosition.Manual
                'Select Case StrPosition
                'Case 1
                If IntLocationBase = 0 Then

                    .Location = New Point(Me.Left, Me.Bottom + objFrm2.Top)
                    IntLocationBase = Me.Bottom + objFrm2.Height-----Need help here

                Else
                    .Location = New Point(Me.Left, IntLocationBase + objFrm2.Height) ------Need help here
                    IntLocationBase += objFrm2.Height -----Need help here
                End If
                .Show()
            End With

Open in new window

0
 

Author Closing Comment

by:RIAS
ID: 41895866
Cheers#!
0

Featured Post

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question