【发布时间】:2016-11-16 20:47:17
【问题描述】:
我编写了一个 C# 程序,它应该循环代码以刷新 DateTime 信息并设置标签的文本以匹配。但是,当我运行它时,表单不显示。为什么会发生这种情况,如何让表单显示?
这是我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Clock
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new clock());
}
}
}
忽略我的缩进(可能对也可能不对,但在程序中是正确的),我做错了什么,我该如何解决?
谢谢!
洛根·斯洛维克
【问题讨论】:
-
最好的调试方法可能是在
Application.Run(new clock())的行上设置一个断点,看看你是否能达到它 -
您的问题不在提供的代码中。
-
并回答标题问题... while(true) { ... }
-
@series0ne,原来如此...通常当程序缩进不佳时,它更更明显...
-
@DangerZone 完全同意! (我对此很感兴趣!:D)