Mask Popup dialog box

Source: Internet
Author: User

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;usingmshtml;namespacewindowsapplication2{ Public Partial classForm1:form {//Initial InterfaceUri Temp1 =NewUri ("http://www.ahbys.com/ahbysCom/login.html"); //home page after landingUri Temp2 =NewUri ("http://www.ahbys.com/ahbysCom/");        StreamReader SR;                String Line; //Save Flag bit        BOOLBaocun =false;  PublicForm1 () {InitializeComponent (); SR=NewStreamReader ("Psychology. txt"); }        Private voidWebbrowser1_documentcompleted (Objectsender, WebBrowserDocumentCompletedEventArgs e) {                                 //when you first log in, fill in the information            if(E.url = =Temp1) {HtmlElement He_name= This. WebBrowser1.Document.GetElementById ("Name"); He_name. InnerText="*******"; HtmlElement He_password= This. WebBrowser1.Document.GetElementById ("PassWord"); He_password. InnerText="*************"; //Submit is exactly 4 .HtmlElementCollection HEC = This. WebBrowser1.Document.GetElementsByTagName ("input"); HtmlElement Elem= hec[4]; Elem. InvokeMember ("Click"); }            //a second jump after login            if(E.url = =Temp2) {                //10370                 This. WebBrowser1.Navigate (@"http://www.ahbys.com/ahbysCom/Dispatch/GraduateEdit_part1.aspx?a=2015&b=10370&c=10432323115292 &p=q&keyword=10432323115292&idx=1&all=1"); }            //the actual work            if(E.url.tostring (). IndexOf ("http://www.ahbys.com/ahbysCom/Dispatch/GraduateEdit_part1.aspx?a=2015&b=10370") >=0)            {                             if( This. WebBrowser1.Document.GetElementById ("txtDiscipline1"). GetAttribute ("value") !="07000000")                {                     This. WebBrowser1.Document.GetElementById ("txtDiscipline1"). SetAttribute ("value","07000000");  This. WebBrowser1.Document.GetElementById ("txtDiscipline1"). InvokeMember ("onchange"); System.Threading.Thread.Sleep ( -); }                               if( This. WebBrowser1.Document.GetElementById ("TxtDiscipline2"). GetAttribute ("value") !="07150000")                {                     This. WebBrowser1.Document.GetElementById ("TxtDiscipline2"). SetAttribute ("value","07150000");  This. WebBrowser1.Document.GetElementById ("TxtDiscipline2"). InvokeMember ("onchange"); System.Threading.Thread.Sleep ( -); }                  This. WebBrowser1.Document.GetElementById ("Txtdiscipline"). SetAttribute ("value","07150100"); }                                         }        stringstr =@"Http://www.ahbys.com/ahbysCom/Dispatch/GraduateEdit_part1.aspx?a=2015&b=10370&c=000000000&p=Q &keyword=000000000&idx=1&all=1"; //Start Traversal        Private voidButton1_Click (Objectsender, EventArgs e) {             This. button1. Enabled =false;  This. button1. Text ="Traverse"; Line=Sr.                       ReadLine (); if(Line! =NULL)            {                This. webbrowser1.navigate (str. Replace ("000000000", line)); Baocun=true; }ElseMessageBox.Show ("has been traversed!");  This. button2. Enabled =true;  This. button2. Text ="Save"; }        Private voidForm1_formclosing (Objectsender, FormClosingEventArgs e) {Sr.        Close (); }        Private voidWebbrowser1_navigated (Objectsender, WebBrowserNavigatedEventArgs e) {            //Auto-click Popup Confirmation or pop-up promptIHTMLDocument2 vdocument =(IHTMLDocument2) webBrowser1.Document.DomDocument; VDocument.parentWindow.execScript ("function confirm (str) {return;}","JavaScript");//Popup ConfirmationVDocument.parentWindow.execScript ("function alert (str) {return;}","JavaScript");//pop-up tips        }        Private voidButton2_Click (Objectsender, EventArgs e) {             This. button2. Enabled =false; if(baocun) {htmlelement ImageButton3= This. WebBrowser1.Document.GetElementById ("ImageButton3"); Imagebutton3.invokemember ("Click");  This. button2. Text = System.DateTime.Now.ToString () +"@ data Saved!"; Baocun=false;  This. button1. Enabled =true; }        }                 }}

Mask Popup dialog box

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.