?
Solved

How to set caret position in a textbox

Posted on 2003-03-19
6
Medium Priority
?
1,676 Views
Last Modified: 2012-06-27
I need to move the caret horizontally and vertically hin a regular MS textbox. Code appreciated, extremely urgent.
0
Comment
Question by:mccainz2
[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
6 Comments
 
LVL 2

Expert Comment

by:Jacamar
ID: 8170871
Please explain a little more.
0
 
LVL 4

Accepted Solution

by:
TigerZhao earned 2000 total points
ID: 8170934
TextBox will automatic set caret position when redraw window, Is property .SelStart not [conform with your need?
0
 
LVL 3

Expert Comment

by:DocM
ID: 8170956
Hi,
Change the selstart property to move the caret.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Author Comment

by:mccainz2
ID: 8170962
Im emulating a vt100 terminal with a textbox, dug into the WINAPI book at my desk and found caret functions

Private Declare Function CreateCaret Lib "user32" (ByVal hwnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function DestroyCaret Lib "user32" () As Long
Private Declare Function SetCaretBlinkTime Lib "user32" (ByVal wMSeconds As Long) As Long
Private Declare Function SetCaretPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function ShowCaret Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function HideCaret Lib "user32" (ByVal hwnd As Long) As Long
0
 
LVL 5

Author Comment

by:mccainz2
ID: 8170966
Im investigating selstart, that may work......Simple is always better....
0
 
LVL 5

Author Comment

by:mccainz2
ID: 8170989
yup, I was making it way too difficult, selstart and sellength will get me all the way home.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

777 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