473,385 Members | 1,409 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,385 software developers and data experts.

VB6/Blinking Cursor/Textbox/Move Cursor

Right now I have a touchscreen with a virual keyboard.

I would like to create arrow keys. If the user messed up the inputted text, he can move the blinking cursor left one space at a time between inputted characters to add a letter. Then a button to move the blinking cursor back to the end of the inputted text.

Private Sub Left Arrow_Click()
If Text1.SelStart Then Text1.SelStart = Text1.SelStart - 1
Text1.SetFocus
End Sub

Private Sub Right Arrow_Click()
If Text1.SelStart < Len(Text1.Text) Then Text1.SelStart = Text1.SelStart + 1
Text1.SetFocus
End Sub

Private Sub Enter Letter_Click()
Text1.Text = Text1.Text + Command1(Index).Caption

For i = 0 To Command1.ubound
Command1(i).Caption = LCase(Command1(i).Caption)
Next

cmdLowercase.Visible = False
End Sub

When the cursor is moved left, I would like to have the next letter inserted where the cursor is blinking, not at the end of what's already entered.

With what I have so far, the cursor will move left after some letters are entered into the textbox. But when the next letter is selected it inserts it at the very end.

Basically in my textbox I want to enter more text wherever the cursor is blinking...

If I select a random part of the entered text and enter another letter or hit the backspace button, it adds the letter at the end or backspaces from the end.

Can anyone help me please?
Oct 1 '08 #1
5 8401
smartchap
236 100+
In the Enter Letter_Click event u have written

Text1.Text = Text1.Text + Command1(Index).Caption

which will obviously add new character at the end of the Text1. First find out the current position of the cursor (in the text box) and then change text in text box when u enter a character.

Also please let me know u want to enter character from key board (actual) or the one u have created on screen.

If any other problem please post zip file of the project so that I will try to correct it.
Oct 1 '08 #2
I wish to use the keyboard on screen, not the actual keyboard.

Thanks.

Currently working with another recommendation that looks like:

Text1.Text = Left(Text1.Text, Text1.SelStart - 1) & Command1(Index).Caption & Mid(Text1.Text, Text1.SelStart + 1)

But I get errors when I place this in my Command1_Click(Index As Integer)

'Invalid procedure call or argument"
Oct 1 '08 #3
smartchap
236 100+
Correct your MID function. It must have three arguments.
Oct 1 '08 #4
QVeen72
1,445 Expert 1GB
Hi,

@SmartChap: Not Necessarily. MID is an Over-loaded function, Omitting the last Argument, returns from the Middle till the end..

@OP,
Once, you change the Text, Your SelStart also changes, you have to reset it..
So that you can hit keys continously..

Try This :
Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer
  2. i = Text1.SelStart
  3. Text1.text = Left(Text1.text, Text1.SelStart) & Command1(Index).Caption  & Mid(Text1.text, Text1.SelStart + 1)
  4. Text1.SelStart = i + 1
  5.  
Regards
Veena
Oct 2 '08 #5
Thanks! Resolved.

Means a lot.
Oct 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Seash | last post by:
Hi friends , here is the sample code private void txtbox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if(e.KeyChar == 13) //enter { txtbox2.Focus(); }
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
2
by: dinny | last post by:
I have a form and a multiline textbox with a message. The problem is that I can see the cursor, is there any way so move the focus away from the textbox so that I don't see the cursor on the form...
1
by: Marc Robitaille | last post by:
Hello I build a usercontrol. On this new control, I added two controls, a TextBox and a ComboBox. My ComboBox is filled with a DataTable. When the user types something in the TextBox, I apply a...
3
by: johnk | last post by:
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...
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...
4
by: Brandon McCombs | last post by:
Does anyone know of an easy way to set the position of the cursor in a TextBox? If I set text in the box that is longer than the length of the TextBox the position of the cursor is at the very end...
5
by: shivasusan | last post by:
Hi! I want to blink the textbox and place the cursor in that text box. (If the user didn't enter the name and click the submit button. That time, the text box want to blink "two or three times") ...
1
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.