Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-11-14
3
Medium Priority
?
233 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Starting up a Project

610 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