【发布时间】:2015-07-27 15:54:13
【问题描述】:
所以基本上我需要在我的 windows 窗体 c# 应用程序中进行 if(!IsPostBack) 检查,因为在从文本框中获取值后,一旦它不再获取该值而是给出 null。但是我收到了错误。错误:
The name IsPostBack does not exist in the current context
我有:
using System.Web.UI;
所以我不确定为什么会这样。任何见解或解决方案将不胜感激,谢谢。
这是我的代码:
if(!IsPostBack)
System.Console.WriteLine("Text: " + textBox2.Text);
MakeSureFieldIsFilledIn errormessagefieldempty = new MakeSureFieldIsFilledIn();
errormessagefieldempty.ShowDialog();
}
【问题讨论】:
-
IsPostBack 是一个 WebForms 概念,而不是 WinForms。在桌面环境中,您永远不会发出 POST。
标签: c# winforms ispostback