Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
Can you please help me.

I have a program which is incomplete. I made a virtual keyboard but the left and right button is not working.

The plan was that every time the left or right button was clicked the text cursor also would move.

Any help is greatly appreciated.

Thanks.
Posted
Updated 15-Jul-11 0:15am
v2
Comments
OriginalGriff 15-Jul-11 6:12am    
Without having at least some of the code we would only be guessing.
Use the "Improve question" widget to edit your question and post the code fragment where you handle the virtual Left and Right buttons, and a similar fragment for a working key.
walterhevedeich 15-Jul-11 6:12am    
Show us the relevant code for us to better understand your problem
Slacker007 15-Jul-11 6:16am    
Edited for readability and grammar.

1 solution

Maybe you can try the TextBox.SelectionStart Property.
MIDL
void Left_Button_Click()
{
    if(myTextBox.SelectionStart > 0)
        myTextBox.SelectionStart--;
}

MIDL
void Right_Button_Click()
{
    if(myTextBox.SelectionStart < myTextBox.Text.Length)
        myTextBox.SelectionStart++;
}


http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.selectionstart.aspx[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900