1.

Solve : Help With C# Program?

Answer»

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!

Code: [Select]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();
               
            }
           
        }
    }
}In the submit button event HANDLER you could put something like
Button Name.visibility = False;
(It would help if you posted the other file of code (partial class)



Discussion

No Comment Found