Solved

Synchronizing cursors and text boxes between forms in a VB.NET application.

Posted on 2006-11-14
3
229 Views
Last Modified: 2010-05-18
We have an application that may or may not display more than one form at a time.  We would like the cursor to be the same on all of them.  IN other words, change the cursor on one and the rest will follow.  Also, there are text boxes on them we would also like to be the same.  Right now we are writing the text for each form in a separate line.  Any ideas?

We've tried a handler:

Addhandler MyBase.CursorChanged, Addressof Change_Cursor

Public Sub Change_Cursor(sender as Object, e as System.EventArgs)
 form2.Cursor = Me.Cursor
 form3.Cursor = Me.Cursor
End Sub


It should change the cursors in form2 and form3 when we set Me. Cursor=Cursors.WaitCursor shouldn't it?
0
Comment
Question by:ddepuemd
3 Comments
 
LVL 3

Accepted Solution

by:
royce2020 earned 50 total points
ID: 17942076
My VBs a bit rusty, but if the sender is the control you could try:

Public Sub Change_Cursor(sender as Object, e as System.EventArgs)
 form2.Cursor = sender.parent.Cursor
 form3.Cursor = sender.parent.Cursor
End Sub

or if the sender is the form itself:

Public Sub Change_Cursor(sender as Object, e as System.EventArgs)
 form2.Cursor = sender.Cursor
 form3.Cursor = sender.Cursor
End Sub

The problem here is that the sub will be run in the global space (even if it's in the same chunk of code as the sender), so the keyword "me" is meaningless. Also, the reference to the forms looks wrong (unless say "form2" and "form3" are globals) you might want to referto them as forms("form2").Cusor Another thing to check, is that this code is even being run, buy putting a break point on the first line of the sub. If it dosen't break, then the problem is with the handler.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
This is about my first experience with programming Arduino.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question