フォームが 2 番目のフォームをロードできないという問題があります。認証サーバーをセットアップしようとしています: 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)
{
}
}
}