我正在爲此工作一些日子。現在我有另一個問題。所以,我有這在我的zzz.cs
:顯示新表格不起作用
private void button3_Click_1(object sender, EventArgs e)
{
scraper zzz = new scraper();
zzz.Show();
}
對於1個原因,不想要打開叫做scraper.cs
其他窗口的形式。我的zzz.cs
和scraper.cs
具有相同的命名空間。這怎麼能工作?什麼是修復?
編輯:
的問題已得到修復,但現在從login.cs它並不去zzz.cs.我的代碼是:
MessageBox.Show("You are logged in successfully");
zzz zzz = new zzz();
zzz.Show();
this.Close();
但現在不起作用。如何解決這個問題?之前它的工作,現在不再...
我再次嘗試。我看到zzz.cs打開。然後用照片直接代碼將關閉:0。這裏是我的zzz.cs再次:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Login
{
public partial class zzz : Form
{
public static List<string> proxies { get; set; } = new List<string>();
public static List<string> Links { get; set; } = new List<string>();
public static string path;
public zzz()
{
InitializeComponent();
}
private void button1_Click_1(object sender, EventArgs e)
{
Logs.Items.Clear();
if (radioButton1.Checked == true)
{
bool useproxies = true;
Logs.Items.Add("Using proxies enabled!");
scrape();
}
else
{
bool useproxies = false;
Logs.Items.Add("Using proxies disabled!");
}
void scrape()
{
int omg = proxyscraper();
}
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
public int proxyscraper()
{
return 0;
}
private void button3_Click_1(object sender, EventArgs e)
{
//Form1 aaa = new Form1();
//aaa.Show();
}
}
}
這裏是我的inlogin.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Login
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
//Enter code here for your version of username and userpassword
Login login = new Login("admin", "1234");
private void button1_Click(object sender, EventArgs e)
{
//define local variables from the user inputs
string user = nametxtbox.Text;
string pass = pwdtxtbox.Text;
//check if eligible to be logged in
string login(string lol,string lel)
{
try
{
var request = (HttpWebRequest)WebRequest.Create("http://SNIP/mama.php?user=" + lol + "&password=" + lel);
var response = (HttpWebResponse)request.GetResponse();
string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
return responseString;
}
catch
{
string responseString = "NO";
return responseString;
}
}
string wat = "YES";
if (login(user, pass) == wat)
{
MessageBox.Show("You are logged in successfully");
zzz aaa = new zzz();
aaa.Show();
this.Close();
}
else
{
//show default login error message
MessageBox.Show("Login Error!");
}
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
Howwww ....
1.什麼是'scraper'的定義。 2. WinForms? – Richard
您是否嘗試過通過在Click-Method中設置斷點來調試它?你有沒有發現這個事件?你能爲我們提供你們班的代碼嗎? –
請閱讀[清單](https://meta.stackoverflow.com/questions/260648)並將其應用於您的問題[編輯]。相關:[mcve] – rene