CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2008
    Posts
    4

    How to implement this functionality on C#?

    Dear Friends,
    I need to write the follwing C# code:

    1. Go to some webpage http://www.whatever.com
    2. On this page I need to put "somestring1" into textbox
    <input type="text" name="SomeTextBox" value="">
    3. Get value from this hidden variable (in this example - 23456):
    <input type="hidden" id="SomeVariable" name="SomeVariable" value="23456">
    4. And finaly invoke some "submit":
    <input type="submit" id="MySubmit" name="MySubmit" value="MySubmit">
    so the form will be submited somewhere <form action="someurl" ...>

    Please advice.
    Thanks.

  2. #2
    Join Date
    Jun 2007
    Posts
    99

    Re: How to implement this functionality on C#?

    Is this a webpage you are building? If so why are you using C#?

  3. #3
    Join Date
    Jan 2007
    Posts
    491

    Re: How to implement this functionality on C#?

    Either do that by using the WebBrowser control (the easier choise) or use sockets and send http requests to the site.

  4. #4
    Join Date
    Aug 2008
    Posts
    4

    Angry Re: How to implement this functionality on C#?

    Quote Originally Posted by Selacius
    Is this a webpage you are building? If so why are you using C#?
    I have a task implement this on C#.
    I know how to do it on HTML/php etc.
    But how to do it by using C# i don't know.

  5. #5
    Join Date
    Aug 2008
    Posts
    4

    Re: How to implement this functionality on C#?

    Quote Originally Posted by Talikag
    WebBrowser control
    Could you give me some simple code example to do it?

  6. #6
    Join Date
    Aug 2008
    Posts
    4

    Re: How to implement this functionality on C#?

    Quote Originally Posted by BobWhite2009
    Could you give me some simple code example to do it?
    Let's say I have some code like this:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace WebControlPlay
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
    webBrowser1.Url = new Uri("http://www.whatever.com");
    }
    }
    }

    Now how I put "somestring1" into textbox placed on the http://www.whatever.com
    <input type="text" name="SomeTextBox" value="">
    ?

  7. #7
    Join Date
    Jan 2007
    Posts
    491

    Re: How to implement this functionality on C#?

    There's quite a lot examples on the internet. Try to google "c# webbrowser" or "c# webbrowser example", etc.
    I would show you an example but I'm about to leave, and besides, i guess you'll find some relevant examples on google. I'll show you an example later if you won't...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured