Hack Forums
[C#] Prepopulate textbox with the current date - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Prepopulate textbox with the current date (/showthread.php?tid=6054923)



Prepopulate textbox with the current date - unknown321 - Mar 5, 2020

Im looking to prepopulate a textbox on form load with the mm-dd-yy format using Date textmode. Does anyone know the proper way of doing this ive been having issues getting this to work.


RE: Prepopulate textbox with the current date - gigajew - Mar 5, 2020

string currentDate = DateTime.Now.ToString(“MM-dd-yy”);
textBox1.SetText(currentDate);


RE: Prepopulate textbox with the current date - unknown321 - Mar 5, 2020

(Mar 5, 2020 04:04 PM)gigajew Wrote:  string currentDate = DateTime.Now.ToString(“MM-dd-yy”);
textBox1.SetText(currentDate);

thanks for this works good