Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
291 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 Reply

0 votes
by (71.8m points)

After

frm1.Show()

place

frm1.txtTicket.Focus()

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...