Solved

Setting runtime form location

Posted on 2016-11-21
4
18 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
  • 2
4 Comments
 
LVL 32

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now