Patric Nøis Patric Nøis - 2 months ago 16
C# Question

C# Breakpoint hit the debugger

Soo ive justed completed one of my first projects in c# but then i run upp on this
"Live Event: Breakpoint Hit: Timer1_tick, Forn A breakpoint or a tracepoint was hit by the debugger". i cant realy find anything wrong whit my codes soo i dont realy know how to solve this here is the code ive been trying

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;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
webBrowser1.Navigate("mywebsite.com");
webBrowser1.ScriptErrorsSuppressed = true;
}
private int failed = 0;
string startbet = "250";
string bet2 = "150000";
string bet3 = "300000";
string bet4 = "600000";
string bet5 = "1200000";
string bet6 = "2400000";
string bet7 = "4800000";
private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("brukernavn")[0].SetAttribute("value", textBox1.Text);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("passord")[0].SetAttribute("value", textBox2.Text);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("login_buton")[0].InvokeMember("click");
timer1.Enabled = true;
}

private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Navigate("mywebsite.com/gamblingsite.php");
webBrowser1.DocumentCompleted += Krigside;
timer1.Enabled = false;
}
private void Krigside(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.DocumentCompleted -= Krigside;
timer2.Enabled = true;
timer2.Interval = 1000;
}
private void timer2_Tick(object sender, EventArgs e)
{
if (webBrowser1.DocumentText.Contains("bokstavene"))
{
MessageBox.Show("Anti-bot! du har 60 sekunder på og fullføre!");
timer2.Enabled = true;
timer2.Interval = 60000; //60 sekunder før den sjekker anti-bot igjen.
}
else
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", startbet);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer2.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
}
private void SjekkVinnFeil(object sender, WebBrowserDocumentCompletedEventArgs e)
{
MessageBox.Show("KRIG SIDEN ER KLAR!");
webBrowser1.DocumentCompleted -= SjekkVinnFeil;
if (webBrowser1.DocumentText.Contains("taper"))
{
failed += 1;
}
else
{
failed = 0;
}
timer3.Enabled = true;
}

private void timer3_Tick(object sender, EventArgs e)
{
if (webBrowser1.DocumentText.Contains("bokstavene"))
{
MessageBox.Show("Anti-bot! du har 60 sekunder på og fullføre!");
timer3.Enabled = true;
timer3.Interval = 60000; //60 sekunder før den sjekker anti-bot igjen.
}
else if (failed == 3)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet2);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 4)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet3);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 5)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet4);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 6)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet5);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 7)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet6);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 8)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet7);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", startbet);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
}

private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
timer2.Enabled = false;
timer3.Enabled = false;
MessageBox.Show("Stoppet!");
}

private void textBox2_TextChanged(object sender, EventArgs e)
{

}
}
}


and ive been looking over my codes a couple of time now whitout understanding whats wrong soo i hoped any one here could help me tell what im doing wrong. im fresh to c# so i hope you can help me out as ive already tryed to search the problem whitout any luck of solving it.

Answer

So your sole question is why the breakpoint is hitting? If yes, then it's cause you have set the breakpoint at some time for debugging purpose. if you don't want them any more then you may consider deleting the breakpoint by choosing debug menu option and select delete all breakpoint or disable all breakpoint.

You may as well consider running the application in Release mode with option start without dedbugging. (OR) in web.config / app.config set the below line

<Compilation debug="false" />
Comments