我有这段代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ConsoleApplication2
{
class Program
{
static void Main(string args)
{
string TheFormText;
string TheFormName;
string TheFormTag;
Form activeForm = Form.ActiveForm;
TheFormText = activeForm.ActiveMdiChild.Text.ToString();
TheFormName = activeForm.ActiveMdiChild.Name.ToString();
try
{
TheFormTag = activeForm.ActiveMdiChild.Tag.ToString();
}
catch
{
TheFormTag = "<none>";
}
}
}
}
我尝试运行但是当我这样做时我得到了这个错误 ConsoleApplication2.exe中发生了未处理的“System.NullReferenceException”类型异常