0

我在允许我的表单加载第二个表单时遇到问题。我正在尝试设置身份验证服务器:在名为 Form2 的表单上。如果验证码正确,则将其编程到 MainForm。所以我希望它在显示“禁用身份验证代码”后关闭 Form2 并加载 MainForm。这是 Form2 的代码(带有身份验证服务器代码的表单)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Diagnostics;
using System.Threading;
using System.IO;
using System.Net;
using System.Security.Cryptography;


namespace BBP
{
public partial class auth : Form
{

public static String Auth = null;
public static String Authcode = null;
public static String ip = null;
public auth()
{

InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
{
Auth = textBox1.Text;
if (Auth == (""))
{
MessageBox.Show("Enter Auth Code");
}

else
if (webBrowser3.Document.Body.InnerText.Contains(textBox1.Text))
MessageBox.Show("Auth Code Disabled");
else
if (webBrowser1.Document.Body.InnerText.Contains(textBox1.Text))
{
this.Hide();
 Form2 f2 = new Form2();
 f2.ShowDialog();
Application.Exit();
}
  else

 if (webBrowser2.Document.Body.InnerText.Contains(textBox1.Text))
 {

 this.Hide();
 Form2 f3 = new Form2();
 f3.ShowDialog();


Application.Exit();
}
else
{
MessageBox.Show("Invalid Auth Code");
}

}}

 private void webBrowser1_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e)                       
 {

 }


 }
 }
4

1 回答 1

0

关闭“Application.Exit()”行并重试。说:退出应用程序后,您无法打开表单。

于 2012-12-22T19:34:34.680 回答