If anyone is interested in a Visual Basic developer job in the New York Metro area please forward your resume to firstname.lastname@example.org. The brief requirements are 5+ years of Visual Basic development, must be able to solve any kind of development issue, deal with customers and have great communications skills. Very good English is essential since you will be interacting with clients on a daily basis. For some details about the company check their web site at http://www.mcgnet.com. MCG Inc offers very competitive salary with lots of benefits. It's a GREAT company to work for. If you do not meet the above requirements, please do not send your resume, you will not be considered for the job.
This issue introduces a routine to calculate the word that the mouse is hovering over in a rich text box control.
If you have any questions about using this module, let us know at email@example.com
This module is useful for a variety of reasons. One great use is to allow a right-click to perform some particular action on that particular word (such as a spell check or deletion). It can also be used to change the formatting of the highlighted word.
There is also a bonus routine in this issue which determines if a character is AlphaNumeric. Our definition of alphanumeric is any letter from A to Z, any number from 0 to 9 or an underscore.
Public Function IsAlphaNumeric(sChar As String) As Boolean
Returns True if sChar is alpha numeric. Our definition is A-Z, 0-9 and _ (underscore).
Public Function MouseOverWord(oRichTextBox As RichTextBox, X As Single, Y As Single) As String
This routine does all the work. oRichTextBox is the rich text box control that is on the form. X and Y are the current mouse positions (such as what is returned in the MouseMove event of the RichTextBox. The MouseOverWord routine will return the alphanumeric word that the mouse is currently located over.
If there is no word the mouse is over it will return a blank string.
This sample shows how to use the MouseOverWord routine. It assumes you have a form with a RichTextBox control on it.
Private Sub RTControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim sWord As String sWord = MouseOverWord(RTControl, X, Y) ' sWord will contain the "highlighted" word. End Sub
To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0132.html