[英]How to add a timer in MessageBox.Show()?
如標題所示,我知道MessageBox.Show具有添加字符文本的功能,我想知道在MessageBox.Show中是否存在用於添加系統時間的代碼? 喜歡:
MessageBox.Show("Hello, today's date is: " & time.now)
我知道這段時間的代碼很奇怪,所以只是希望是否有人知道如何添加系統用戶計算機的當前時間?
看起來像VB語法。 如果要使用C#語法在消息中顯示日期,請使用以下命令:
MessageBox.Show(string.Concat("Hello, today's date is: ", DateTime.Now);
要簡單地做到這一點,只需使用以下命令:
MessageBox.Show(DateTime.Now.ToString());
或者,在您的情況下:
MessageBox.Show("Hello, today's date is: " + DateTime.Now.ToString(), "Attention!",
MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox類幾乎重載了您可能想要的所有內容; 如果沒有它,您總是可以自己制作。
你的意思是
MessageBox.Show( "Hello, today's date is: " + DateTime.Now.toString);?
MessageBox.Show("Hello, today's date is: " & DateTime.Now.ToString())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.