Open a form where mouse clicked


M

Marcolino

Hi,
I'm new with VB.net and I comming from VB6 programming.

I need to open a little form in Modal and child of MDI, with the top-
left corner where the mouse has clicked.
I tryed this code but the form show everywhere but not where i need:

Private Sub btnDataAcquisto_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnDataAcquisto.Click
Dim frm As New frmKeeperDate

frm.Location =
Me.PointToClient(System.Windows.Forms.Cursor.Position)
frm.ShowDialog()

frm = Nothing

End Sub


frmKeeperDate is my form and I need that it will open when I click on
button with its top-left corner where mouse is.

Any help would be appreciated.

--Marco
 
Ad

Advertisements

G

Guest

Marco,

You can't show a form both as an MDI child and modally.

However, here is one way to show a non-child form modally at the cursor
position:

Dim frm As New frmKeeperDate
frm.StartPosition = FormStartPosition.Manual
frm.Location = System.Windows.Forms.Cursor.Position
frm.ShowDialog()

Kerry Moorman
 

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

Top