Wrox Programmer Forums
|
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2010, 08:36 PM
Registered User
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rich Text Boxes and their pesky cursors

Greetings. When I'm not studying the book, I've been writing a little Windows word processor application using a Rich Text Box. One quick question. How do I put the blinking cursor at the top left (the 0,0 coordinates) of the rich text box so that the user can begin typing immediately (after the application loads and the form displays) instead of having to move the mouse over to that position and clicking? Just giving the rich text box 'focus" doesn't do the trick, and I've tried a few other commands that didn't work either. It's a minor thing, but it bugs me that I can't get this to work. THANKS!

Bob
 
Old March 9th, 2010, 05:46 PM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default RTB

Not sure what the problem is. I put a button on a form with a rich text box and put this line in the button click event:

rtc.Focus();

and when I click the button, the cursor appeared in the rtb. Try it and see if that's what you need.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
 
Old March 9th, 2010, 06:23 PM
Registered User
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Boxes and their pesky cursors

Thanks for your response, but giving the rich text box focus doesn't put the cursor at the upper left of the box and ready for input. If the "focus" command is supposed to work this way, then perhaps something is goofy in the way I set the control up. I want this to work like Wordpad does. When you open Wordpad, the cursor is already at the top left of the form and ready for input, no clicking required by the user. That's all I'm looking for here.
 
Old March 11th, 2010, 01:54 AM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Cursor in RTB

Do you have the tab index for the RTB as the first one in the list of controls? If some other control has a lower tab index, it will gain focus first. (I'm assuming you already did this, but this would cause the problem to manifest itself.)
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
 
Old March 11th, 2010, 11:06 PM
Registered User
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rich Text Boxes and their pesky cursors

Jack,
You were 100% correct. It was the tab control that was giving me the problem. I guess I had a brain freeze concerning the tabs. There was a button on my form that had a tab index of 2, and that's where the focus was being held when the application started. I changed my rich text box to a tab index of 1 and voila, the problem was solved. It's always the little things that come back to bite you! Thanks for your help.

Bob C.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing pesky dialog boxes. FalseParadigm Access VBA 22 July 20th, 2007 08:47 AM
Rich Text Boxes speedlearner Pro VB 6 2 July 2nd, 2006 09:02 AM
Rich Text Boxes speedlearner All Other Wrox Books 1 June 22nd, 2006 08:04 AM
Rich Text Editor PC User Access 0 June 5th, 2004 04:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.