Solved

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

Posted on 2006-11-14
3
231 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 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

Independent Software Vendors: 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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Progress
Starting up a Project

724 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