First i apologise for my english.

Here is my problem...

I got a web browser on my form.

i'm navigatin to login page(1. Page). My user name and password comes from code. Then i click to submit button... Then navigating another page(2. page).

İn the 2. page there are link. i want to navigate automaticly to one of this link.(3.page)

And on the 3.page there is e textbox and i want to will the field autamaticly too...

can andybody help?

Well, to navigate to the URL on Form2, you would do this:

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 Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            webBrowser1.Navigate("http://www.google.com/");
        }
    }
}

If the URL is in a TextBox, then you could just do this:

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 Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.Text = "http://www.google.com/";
            webBrowser1.Navigate(textBox1.Text);
        }
    }
}

If this is not what you are asking, please specify what you are trying to do.

no sorry that is not my question.

Here is my codes working for now :) Maybe it can be more clear.

there is a counter which keeps the page numbers... it called _sayac

  private void Form3_Load(object sender, EventArgs e)
        {
            webBrowser1.Url = _target;
            webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
        }



  void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

            WebBrowser b = (WebBrowser)sender;
            switch (counter)
            {
//Those are login information
                case 0:
                    b.Document.GetElementById("j_username").InnerText = "xxx";
                    b.Document.GetElementById("j_password").InnerText = "xx";
                    b.Document.GetElementById("isyeri_sifre").InnerText = "xx";
                    b.Document.GetElementById("isyeri_kod").InnerText = "xx";
                    counter++;
                    return;
//fter login there is a link o the page... and navigating here...
                case 1:
                    webBrowser1.Navigate("http://app.sgk.gov.tr/SigortaliTescil/jsp/anamenu.jsp ");
                    counter++;
                    return;
//then on the 3.page there is a fied. which i have to take automaticly from Db.
//and raise the click  event
                case 2:
                    b.Document.GetElementById("tckno").InnerText = "15352902322";
                    b.Document.GetElementById("button1").InvokeMember("Click");
                    _sayac++;
                    return;

// After raise event i have to go forward again
                case 3:
                    b.Document.GetElementById("button3").InvokeMember("Click");
                    b.Document.GetElementById("tckno").InnerText = "15352902322";
                    counter++;
                    return;
// the last page there is lots of control that i have to fill
                case 4:
                    b.Document.GetElementById("tx_TekIsGirTarGG").InnerText = "01";
                    b.Document.GetElementById("tx_TekIsGirTarAA").InnerText = "02";
                    b.Document.GetElementById("tx_TekIsGirTarYY").InnerText = "2003";
                    b.Document.GetElementById("sigtur").SetAttribute("value", "0");
                    b.Document.GetElementById("cmb_Ozurkod").SetAttribute("value", "H");
                    b.Document.GetElementById("cmb_eskiHukumlu").SetAttribute("value", "H");
                    b.Document.GetElementById("gunsayisi").SetAttribute("value", "15");
                    b.Document.GetElementById("30gundenaz").SetAttribute("value", "H");
                    b.Document.GetElementById("tx_Bulvar").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Cadde").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Sokak").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Mah").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Kapi").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Daire").InnerText = "Deneme";
                    b.Document.GetElementById("adresIlId").SetAttribute("value", "17");
                    //Kontrol Yaptırılacak/ il e göre il.e gelecek vesselam
                    b.Document.GetElementById("adresIlceId").SetAttribute("value", "");
                    b.Document.GetElementById("tx_Koy").InnerText = "Deneme";
                    b.Document.GetElementById("tx_PostaKodu").InnerText = "Deneme";
                    b.Document.GetElementById("cmb_Ulke").SetAttribute("value", "TC");
                    b.Document.GetElementById("tx_Eposta").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Tel1alan").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Tel1").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Tel2alan").InnerText = "Deneme";
                    b.Document.GetElementById("tx_Tel2").InnerText = "Deneme";
                    b.Document.GetElementById("csgbiskolukod").SetAttribute("value", "1");
                    b.Document.GetElementById("tx_csgb_S").InnerText = "Deneme";
                    b.Document.GetElementById("tx_csgb_Meslek").InnerText = "Deneme";
                    b.Document.GetElementById("tx_csgb_DosyaNo").InnerText = "Deneme";
                    b.Document.GetElementById("tx_csgb_Il").InnerText = "Deneme";
                    b.Document.GetElementById("cbMeslek").SetAttribute("value", "");
                    b.Document.GetElementById("cbgorev").SetAttribute("value", "");

                    counter++;
                    return;
            }
            webBrowser1.DocumentCompleted -= webBrowser1_DocumentCompleted;

        }

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.