Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countAbc challenge 9 50
word0 challenge 3 58
C# DataGridView_RowsAdded event not firing 1 40
index Out OF Range Exception error 4 33
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.
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.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now