Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please tell me coding in c# that how can i get output in textbox not input. and no one can enter any value in the textbox..
Posted
Comments
[no name] 3-Sep-12 9:32am    
Or use a label.
Sandeep Mewara 3-Sep-12 13:45pm    
Why textbox then?

Use the Readonly[^] property of the textbox.

YourTextboxID.ReadOnly = true;
 
Share this answer
 
C#
textBox1.Enabled = false;
 
Share this answer
 
C#
matextBox.ReadOnly = true;
 
Share this answer
 
Try This :-
Change your textbox Control ReadOnly property to True.
Add the following namespace to your class.
C#
using System.Runtime.InteropServices;

Then add the following code to your class level scope :-
C#
[DllImport("user32.dll")]private static extern bool HideCaret(IntPtr hWnd);

Then go to your Textbox control Click Event and write the code like this.
C#
private void textBox3_Click(object sender, EventArgs e)
{
     HideCaret(this.textBox3.Handle);
}


IF your problem is solved then please accept as Solution. IF any query, Please comment or reply.
 
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