Click here to Skip to main content
15,909,039 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have textbox with default text e.g mytextbox.text="abcd"; And i want focus(Cursor) after 'd'
i tried many ways but i m getting cursor focused on left hand side that is before 'a'
pls help me out thnks
Posted

1 solution

hii..
Hope this will help u..

public string abcd = "abcd";
public int index=0;

index = textBox1.SelectionStart;
textBox1.Text = textBox1.Text.Insert(index, abcd);
textBox1.SelectionStart = index + abcd.Length;
 
Share this answer
 
Comments
jjjjjjjjjjjssssssssssssaaaaaaaaaa 24-Mar-12 4:42am    
No sir that SelectionStart property in not coming for textbox how to get that property for textbox..thanks
jjjjjjjjjjjssssssssssssaaaaaaaaaa 24-Mar-12 4:53am    
i came to know that SelectionStart works only in windows forms not in webforms but i m working on webforms..so plss help me out
swapnilKumbhar 26-Mar-12 2:18am    
http://forums.asp.net/t/1454421.aspx/1

refer aarif.mansuri ans.

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