By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,613 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,613 IT Pros & Developers. It's quick & easy.

Form display problem

P: n/a
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


Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
David,

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

Kerry Moorman
"David A. Osborn" wrote:
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


Nov 21 '05 #2

P: n/a
Are these different from NewForm.Top and NewForm.Left?
"Kerry Moorman" <Ke**********@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
David,

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

Kerry Moorman
"David A. Osborn" wrote:
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



Nov 21 '05 #3

P: n/a
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!
"David A. Osborn" <do********@hotmail.com> wrote in message
news:uUeAd.274058$V41.202382@attbi_s52...
Are these different from NewForm.Top and NewForm.Left?
"Kerry Moorman" <Ke**********@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
David,

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

Kerry Moorman
"David A. Osborn" wrote:
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




Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.