how can i insert current date and time in a textbox?

A TextBox simply displays the value of its Text property, which is a String.

The DateTime data type has a Now property that will return a DateTime value containing the current date and time. That value has methods ToLongDateString, ToLongTimeString, ToShortDateString, ToShortTimeString and ToString. That last one will accept a format specifier to output the date and/or time in a specific format.

Are you sure that a TextBox is the right option? If you just want to display then a Label would be more appropriate. If you want the user to input dates and/or times then a DateTimePicker would likely be more appropriate.
 
Back
Top