473,320 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

textbox cursor placement

Hi, I am trying to get a textbox in a form to display a partial item
entry, i.e. "WER-5-" as most item serial numbers contian this value.
I want the cursor at the end of this text but it is always at the
beginning. How do I get it at the end. I remember at one faking
character input to do something similar but can't remember how I did it.

Jan 12 '06 #1
3 7273
If you want to simulate keypresses, you can use SendKeys. For this
situation, specifically, you'd probably want to use:
SendKeys("{END}")

to simulate using the END key to move your cursor to the line.

To simulate typing "WER-5", you'd do basically the same thing:
SendKeys("WER-5")

However, there are other ways to put text in a textbox. Most often used
is txtBox="TextToPutIn" . After assigning the text, you would then use
the SendKeys("{END}") to move the cursor.

Jan 12 '06 #2
You could try (in the Form module, assuming the text box is called
"Text0")

Private Sub Text0_GotFocus()
Text0.SelStart = Len([Text0].Text)
End Sub

I have not used this extensively and it seems rather clumsy. I hope
someone else will have a better solution.

Jan 12 '06 #3
In the Enter event for the textbox, try:

Me.txtNameOfTextbox.SelStart = 6

That should move the cursor to the end of the 6th character. If you want the
rest of the text highlighted, that can be done also by adding a SelLength
statement after the SelStart statement.

--
Wayne Morgan
MS Access MVP
<jo***@graham.ca> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi, I am trying to get a textbox in a form to display a partial item
entry, i.e. "WER-5-" as most item serial numbers contian this value.
I want the cursor at the end of this text but it is always at the
beginning. How do I get it at the end. I remember at one faking
character input to do something similar but can't remember how I did it.

Jan 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: objectref | last post by:
Hi to all, we have the MousePosition property that we can get the Point of the position of the mouse cursor on the screen, but is it there a way to get the respective Point of a cursor in a...
3
by: bitwxtadpl | last post by:
I want to programmatically set the position of a cursor in a textbox that has focus based on a X and Y value. However, when I send a WM_RBUTTONDOWN and a WM_RBUTTONUP message to the textbox it...
9
by: DotNetShadow | last post by:
Hi Guys, I have been having this problem recently where I have a form with a textbox and button, if in the button event I have the following: Private Sub Button1_Click(ByVal sender As...
2
by: ThunderMusic | last post by:
Hi, I have a form in which there are many <asp:textbox> tags. When I run the form, we use tab to navigate across the textboxes, but one of our client noticed that when we navigate to some readonly...
10
by: scoonie999 | last post by:
I'm having a problem that I can't seem to find any solution for online. I'm using a cursor in a cobol program to fetch some data. I know for a fact that the select should return 2 rows. The...
13
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the...
10
by: garyusenet | last post by:
I have a multiline textbox. The size of the text box should be 75 characters wide, and 5 lines in height like this: - <---75 characters--> <---75 characters--> <---75 characters--> <---75...
3
by: fbergroth | last post by:
Hi, I'm quite new to C# allthough I've been programming in other languages for quite a while. I'd like to change the blinking cursor inside a TextBox, I guess I must derive the class and...
0
by: andytsummers | last post by:
Hi I have tried to implement drag and drop by using the following code but I have several problems. 1. When you put your mouse over selected text the cursor is still the i-beam and therefore...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.