Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do i set cursor on TextBox text?

i want the diffrent type of cursor pointer when user mouse over on TextBox text?
in css i did set the cursor:pointer then it shows the handy cursor when i mouse
over the TextBox, but i want to show that on entered Text only, so
how can i do that?
Posted

I don't think you can, here is why:

The TextBox is actually one input Element, not containing inner HTML. Its text is represented by the attribute Value. CSS only works at the level of HTML Elements. In this way, whatever is attributed to the input will be of the same style.

I also think you don't need it; here is why:

The different cursor is not just for decoration (sorry for you if you want just decoration; you customers may not appreciate that), the purpose if the visual feedback: is the cursor where I can type the text. Yes? Click and type; it will work if you clicked inside the element, no matter where the text is.

—SA
 
Share this answer
 
v2
Comments
amit_83 7-Apr-11 5:04am    
Thnakx for reply.
Actuly my textbox is for email, if user type a mail, then i have to show this email as a link. that's why i have this question.is there any other way to make this possible?
I was able to change the cursor like this :

C#
private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
{
    if (!String.IsNullOrEmpty(textBox1.Text))
    {
        textBox1.Cursor = Cursors.Hand;
    }
    else
    {
        textBox1.Cursor = Cursors.Arrow;
    }
}


Is it working for you?
 
Share this answer
 

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