简体   繁体   中英

Disable first line of textbox

I made a program like notepad. I want the first line to be the date and time when the note was made. I get this with:

tbEditor.Text = Convert.ToString(DateTime.Now);

But is it possible to disable this first line so the user can't delete it afterwords?

Use a or to display data that doesn't require user intervention. You can use a stack with textblock and then a text box in it to store date and user note respectively. Alternatively, if you want to use a textbox, you can set IsReadOnly property to true OR IsEnabled property to false. But this is not just for the first line, but for the whole textbox. So you would need a separate control to store the Date and Time

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM