Form display problem

  • Thread starter Thread starter David A. Osborn
  • Start date Start date
D

David A. Osborn

I'm working with VB.net and when ever I dynamically create a form when I do
the form.show() or form.visible = true the form.left parameter gets reset to
22. Does anyone have any ideas why this is happening? Below is a copy of
the function:

Private Function Add_Form() As String

Dim FormNew As System.Windows.Forms.Form

Dim LocalMousePosition_Down As Point

Dim LocalMousePosition_Up As Point

'Covert Screen Coordinates To Form Coordinates

LocalMousePosition_Down = _frmHost.PointToClient(_Mouse_Down)

LocalMousePosition_Up = _frmHost.PointToClient(_Mouse_up)

FormNew = New System.Windows.Forms.Form

FormNew.Left = 15

FormNew.Top = 15

FormNew.Size = New System.Drawing.Size(750, 500)

FormNew.Text = "New Form"

FormNew.MdiParent = _frmHost

'_frmHost.Text = "New Form" Don't know why I did this because it changes the
main window

AddHandler FormNew.MouseDown, AddressOf frmGeneric_MouseDown

AddHandler FormNew.MouseUp, AddressOf frmGeneric_MouseUp



'Code to Form Button to Collection

Object_Collection.Add(FormNew)

FormNew.Show()

End Function
 
David,

Have you tried setting the form's StartPosition and Location properties?

Kerry Moorman
 
Ok, I got it to work by setting the start position to manual and then
setting the location. I guess I don't understand what the different is
between setting the Form.Top and Form.Left as compared to setting
Form.StartPosition and then Form.Location?

For that matter what's the difference in setting Form.Size as compared to
Form.Width and Form.Lenght?

Thanks for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top