?
Solved

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

Posted on 2006-11-14
3
Medium Priority
?
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
royce2020 earned 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Make the most of your online learning experience.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
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 …
Starting up a Project
Suggested Courses
Course of the Month7 days, 22 hours left to enroll

765 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