I need help with my program. Here is the source code. It is in C#. My problem is that it is submitting after I click the submit button but it continues to submit. I want it to submit once and then stop. I don't want it to close. Just kind of pause/ be finished. Please help me out. Thanks!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void webWeebly_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webWeebly.DocumentText.Contains("Comment");
webWeebly.Document.GetElementById("input-705652889195239588").SetAttribute("value", txtFirst.Text);
webWeebly.Document.GetElementById("input-705652889195239588-1").SetAttribute("value", txtLast.Text);
webWeebly.Document.GetElementById("input-959379682711960375").SetAttribute("value", txtEmail.Text);
webWeebly.Document.GetElementById("input-574159613867142544").SetAttribute("value", txtComment.Text);
HtmlElementCollection WebElements = webWeebly.Document.All;
foreach (HtmlElement SubBtn in WebElements)
{
if (SubBtn.GetAttribute("value") == "Submit")
{
SubBtn.InvokeMember("click");
}
}
}
private void btnSubmit_Click(object sender, EventArgs e)
{
webWeebly.Navigate("http://firecactus.weebly.com/contact-us.html");
while (!(webWeebly.ReadyState == WebBrowserReadyState.Complete))
{
Application.DoEvents();
}
}
}
}