Answered by:
Proxy scraper error

Question
-
I have made up a proxy program but I am having some problems with it - specifically these two errors.
Error 1
Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement and this
Error 2
'System.Windows.Forms.ListBox.ObjectCollection' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Windows.Forms.ListBox.ObjectCollection' could be found (are you missing a using directive or an assembly reference?)
Here is my C# file:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; namespace Login { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { System.Net.WebRequest request = System.Net.HttpWebRequest.Create("http://awmproxy.net/freeproxy.php"); System.Net.WebResponse response = request.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()); string newestversion = sr.ReadToEnd(); System.Text.RegularExpressions.Regex expression = new System.Text.RegularExpressions.Regex("[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}:[0-9]{1,5}"); System.Text.RegularExpressions.MatchCollection mtac = expression.Matches(code); foreach (Match itemcode in mtac) { listBox1.Items.Add(itemcode); } } private void button2_Click(object sender, EventArgs e) { if ((listBox1.Items.Count == 0)) { MessageBox.Show("Please Scrape Proxies First.", "ALERT!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { System.IO.StreamWriter S_W; string[] itms; listBox1.Items.ToString; SaveFileDialog save = new SaveFileDialog(); int it; save.FileName = "Grabbed Proxies"; save.Filter = "Grabbed Proxies (*.txt)|*.txt|ALL Files (*.*)|*.*"; save.CheckPathExists = true; save.ShowDialog(this); S_W = new System.IO.StreamWriter(save.FileName); for (it = 0; (it <= (listBox1.Items.Count - 1)); it++) { S_W.WriteLine(listBox1.Items.Item[it]); } S_W.Close(); } } private void button3_Click(object sender, EventArgs e) { listBox1.Items.Clear(); } public string code { get; set; } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { } } }
Answers
-
Done
- Marked as answer by Punisher75 Wednesday, August 16, 2017 10:40 AM
-
Thanks so much for your time and knowledge you know you stuff I thanks you very much keep safe talk soon
your welcome : )- Marked as answer by Punisher75 Wednesday, August 16, 2017 10:53 AM
All replies
-
Q1. you need to drop "ListBox" UI Item to your form from toolbox.
"listBox1.Items.Item[it]" is wrong, you need to code "listBox1.Items[it]" like this
"listBox1.Items[].ToString" is wrong, you need to code "listBox1.SelectedItems[1].ToString()" like this
Q2. I check your code has not got any problem.
Maybe you may check it .Net Framwork version. (.Net framework 4 or later)
Because you have used LINQ. It depends on .Net framework 4.
To check your reference , you may add reference if it hasn't done it.
Or you may create windows form project again to check where you did wrong in process.
-
-
Your three buttons event-listener need to move on Form1.cs.
This my sample result:
Your Form1.Designer.cs I coded it and changed a little bit. It can run. Then you can code it.
partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.listBox1 = new System.Windows.Forms.ListBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // listBox1 // this.listBox1.AccessibleName = ""; this.listBox1.FormattingEnabled = true; this.listBox1.ItemHeight = 12; this.listBox1.Location = new System.Drawing.Point(83, 65); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(120, 88); this.listBox1.TabIndex = 0; // // button1 // this.button1.Location = new System.Drawing.Point(12, 207); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 1; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click_1); // // button2 // this.button2.Location = new System.Drawing.Point(104, 207); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 2; this.button2.Text = "button2"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click_1); // // button3 // this.button3.Location = new System.Drawing.Point(197, 207); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 3; this.button3.Text = "button3"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click_1); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 261); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.listBox1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); } public string code { get; set; } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { } #endregion private ListBox listBox1; private Button button1; private Button button2; private Button button3; }
-
-
This is my Login
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using BetterSeal; namespace Login { public partial class Form1 : Form { Seal Seal = new Seal(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string username = textBox1.Text; string password = textBox2.Text; LoginResponse response = Seal.Login(username, password); Console.WriteLine(response.status); if (response.status) { MessageBox.Show("Success! Welcome" + response.username); this.Hide(); Form2 f2 = new Form2(); f2.FormClosing += (s, args) => this.Close(); f2.Show(); } else MessageBox.Show("ERROR: " + response.info); } private void Form1_Load(object sender, EventArgs e) { AuthResponse response = Seal.Authenticate("Better Seal Code Here"); if (!response.status) { Console.WriteLine("Auth failed"); Environment.Exit(0); } { } } private void textBox1_TextChanged(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { string username = textBox1.Text; string password = textBox2.Text; string license = textBox3.Text; RegisterResponse responcse = Seal.Register(username, password, license); Console.WriteLine(responcse.status); if (responcse.status) { MessageBox.Show("Thank you for Redeeming a License!"); //dsa/da } else MessageBox.Show(responcse.info); } } }
-
do u think you could help me over skype please i would really appreciate it very much so i can understand what you are saying
I couldn't do it right now, but I can give you my sample project
I don't change a lot, just make it can be run, so you can compare what different with it, you may download it.
- Edited by 電腦神手吳子陵 Tuesday, August 15, 2017 9:07 AM
- Proposed as answer by Michael.Webber Tuesday, August 15, 2017 4:53 PM
-
-
ok i'm fixing it up know and i have one code error and it is
The method or operation is not implemented.
Error:
The variable 'itms' is declared but never used
- Edited by 電腦神手吳子陵 Tuesday, August 15, 2017 6:53 AM
- Proposed as answer by Michael.Webber Tuesday, August 15, 2017 4:53 PM
-
-
Debugger:Exception Intercepted: button1_Click_1, Form1.cs line 32
An exception was intercepted and the call stack unwound to the point before the call from user code where the exception occurred. "Unwind the call stack on unhandled exceptions" is selected in the debugger options.
Time: 15/08/2017 5:13:33 PM
Thread:Main Thread[9720] -
It's ok. it will be my honor. Hope can help you.
To 「The method or operation is not implemented.
throw new Exception("The method or operation is not implemented.");」
That's mean you need to code some return Exception message if your code runs wrong.
So How can we get or do from those options?
1. You can deal erros or exception when your function run by your logic and some sitation, Like user's Behaviors you.
2. Be able to get some infomation that you can know what happen when you're debuging.
- Edited by 電腦神手吳子陵 Tuesday, August 15, 2017 10:02 AM
- Proposed as answer by Michael.Webber Tuesday, August 15, 2017 4:53 PM
-
i'm running your code that u gave me to see how it works but it keeps giving me the erorrs like this one
Debugger:Exception Intercepted: button1_Click_1, Form1.cs line 32
An exception was intercepted and the call stack unwound to the point before the call from user code where the exception occurred. "Unwind the call stack on unhandled exceptions" is selected in the debugger options.
-
i'm running your code that u gave me to see how it works but it keeps giving me the erorrs like this one
Debugger:Exception Intercepted: button1_Click_1, Form1.cs line 32
An exception was intercepted and the call stack unwound to the point before the call from user code where the exception occurred. "Unwind the call stack on unhandled exceptions" is selected in the debugger options.
Pardon me!
Is it a result that you need below the image?
-
-
-
when build it then run it from the debug folder i get this error
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: input
at System.Text.RegularExpressions.Regex.Matches(String input)
at WFAExample1.Form1.button1_Click_1(Object sender, EventArgs e) in j:\Jdownloads\Cracking\Proxy.Project\BetterSeal\WFAExample1\WFAExample1\Form1.cs:line 32
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
WFAExample1
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///J:/Jdownloads/Cracking/Proxy.Project/BetterSeal/WFAExample1/WFAExample1/bin/Debug/WFAExample1.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box. -
You just change it below:
"System.Text.RegularExpressions.MatchCollection mtac = expression.Matches(code);"
to
"System.Text.RegularExpressions.MatchCollection mtac = expression.Matches(newestversion);"
Beacuae the result httprequest response is pass to "newestversion", so you don't need this "code" variable. -
-
ok that worked know i'm going to add my login and then i will check the form around so it will login 1st then go to the scraper i will let you know how i go thanks so much m8 4 your help
Your welcome! :) (Don't forget to give me as "as best answer" XDD)
- Proposed as answer by Michael.Webber Tuesday, August 15, 2017 4:52 PM
-
ok that worked know i'm going to add my login and then i will check the form around so it will login 1st then go to the scraper i will let you know how i go thanks so much m8 4 your help
Your welcome! :) (Don't forget to give me as "as best answer" XDD)
Yes he is very help full well done m8 keep safe talk soon -
ok that worked know i'm going to add my login and then i will check the form around so it will login 1st then go to the scraper i will let you know how i go thanks so much m8 4 your help
Your welcome! :) (Don't forget to give me as "as best answer" XDD)
Yes he is very help full well done m8 keep safe talk soon
-
-
Hi m8 hows thing i have come up with another problem if you can help me i will finish this threat of
Type 'Proxy_Project.Form2' already defines a member called 'Form2_Load' with the same parameter types
That means you have defined the same "Form2_Load", you could do "Shift+Ctrl+F", then it will show out a windows let you can search by keyword.
you could type it then find it out. remember, "Look in" you have to set up "Entire Solutaion".
I think you will find two defined of names if you do search keyword.
- Edited by 電腦神手吳子陵 Wednesday, August 16, 2017 7:53 AM
-
ok i got it to work but it wont scrap the proxies i'm lost atm
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; namespace Proxy_Project { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button1_Click_1(object sender, EventArgs e) { System.Net.WebRequest request = System.Net.HttpWebRequest.Create("http://awmproxy.net/777proxy.txt"); System.Net.WebResponse response = request.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()); string newestversion = sr.ReadToEnd(); System.Text.RegularExpressions.Regex expression = new System.Text.RegularExpressions.Regex("[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}:[0-9]{1,5}"); System.Text.RegularExpressions.MatchCollection mtac = expression.Matches(newestversion); foreach (Match itemcode in mtac) { listBox1.Items.Add(itemcode); } } private void button2_Click_1(object sender, EventArgs e) { if ((listBox1.Items.Count == 0)) { MessageBox.Show("Please Scrape Proxies First.", "ALERT!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { System.IO.StreamWriter S_W; string[] itms; SaveFileDialog save = new SaveFileDialog(); int it; save.FileName = "Grabbed Proxies"; save.Filter = "Grabbed Proxies (*.txt)|*.txt|ALL Files (*.*)|*.*"; save.CheckPathExists = true; save.ShowDialog(this); S_W = new System.IO.StreamWriter(save.FileName); for (it = 0; (it <= (listBox1.Items.Count - 1)); it++) { S_W.WriteLine(listBox1.Items[it]); } S_W.Close(); } } private void button3_Click_1(object sender, EventArgs e) { listBox1.Items.Clear(); } private void Form1_Load(object sender, EventArgs e) { } private void Form2_Load(object sender, EventArgs e) { } } }
-
You can't use url "http://awmproxy.net/777proxy.txt"
you must use awmproxy.net gives you one api url such as "http://awmproxy.net/freeproxy.php". this api will give you regular result.
Unless you change your code logic to analysis result of string.
- Edited by 電腦神手吳子陵 Wednesday, August 16, 2017 8:12 AM
-
-
-
-
-
-
-
register and add the forum 2 part for me please so then i know it will work
- Marked as answer by Punisher75 Wednesday, August 16, 2017 9:48 AM
- Unmarked as answer by Punisher75 Wednesday, August 16, 2017 10:15 AM
- Edited by 電腦神手吳子陵 Wednesday, August 16, 2017 10:34 AM
-
-
Can you please delete this link so no body try to change it on me I have downloaded it and it works very well
- Marked as answer by Punisher75 Wednesday, August 16, 2017 10:25 AM
- Unmarked as answer by Punisher75 Wednesday, August 16, 2017 10:26 AM
- Edited by Punisher75 Wednesday, August 16, 2017 10:26 AM
-
-
register and add the forum 2 part for me please so then i know it will work
Done
And this one to please and I will finish this off- Edited by Punisher75 Wednesday, August 16, 2017 10:38 AM
-
Done
- Marked as answer by Punisher75 Wednesday, August 16, 2017 10:40 AM
-
-
Thanks so much for your time and knowledge you know you stuff I thanks you very much keep safe talk soon
your welcome : )- Marked as answer by Punisher75 Wednesday, August 16, 2017 10:53 AM
-
-
-
Hi Punisher75,I am glad to know you solved. Thank you for closed the thread by marking helpful solution as an answer. This will help other members to find the solution quickly if they have faced the similar issue.
Note: Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
Best Regards,
Yohann Lu
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.