Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

vb.net - get cursor position another form in windows application

I have two form in my application i am calling two form together from master page.i wrote code in my master page in top i declared like this Dim form As New FrmDelivary Dim frm1 As New FrmrecievedDelivaryRequest

in toolstrip menu event like this: Dim frm1 As New FrmrecievedDelivaryRequest frm1.Location = New Point(625, 225)
frm1.MdiParent = Me frm1.Show()

Dim frm2 As New FrmDelivary
frm2.Location = New Point(965, 0)
frm2.MdiParent = Me 
frm.show() 

if i press R i want to go my cursor the particular textbox of FrmrecievedDelivaryRequest

if i press D i want to go my cursor the particular textbox of FrmDelivary

How can I do this? i trey something like this in frmMaster_KeyDown event: but same page is showing again. I have already open instance of FrmDelivary, so I don't want to show same page again. I want to just get cursor position to particular textbox of this form

If e.KeyCode = Keys.A Then

    form.Show()
    form.txtTicket.Focus()
    Cursor.Position = form.txtTicket.Location
end if

I am working on vb.net windows application

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After

frm1.Show()

place

frm1.txtTicket.Focus()

I don't think you need the Cursor.Position call


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...