Jump to content

Open custom URL

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
freddyw2

freddyw2

    Newbie

  • Members
  • PipPip
  • 12 posts
Hi there. I was hoping you someone here could give some pointers. Im brand new to C# Only ever used HTML, JS, PHP, AJAX but I'm wanting to branch out. Im using microsoft visual C# 2010 Express

This is the application I'm trying to create.

A user enters a word into a text box thnt is then added onto the end of a url and the url opens a webpage


So a user enters "this link" and when the button is pressed it opens www.someurl.com/thislink

And either that link opens or it displays "Page not found.

This is all I have. Im sorry, like I said I'm brand new and we all need a starting point


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)

        {


        }


        private void textBox1_TextChanged(object sender, EventArgs e)

        {


        }


        private void button1_Click(object sender, EventArgs e)

        {


        }

    }

}



#2
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
OK since your new I'll explain:
 private void button1_Click(object sender, EventArgs e)
        {
          string URL = "http://www.Somewhere.com/" + textBox1.Text;[COLOR=DarkGreen]
[/COLOR]
          System.Diagnostics.Process.Start(URL);
        }
"string URL = "http://www.Somewhere.com/" + textBox1.Text;" First make a new string thats "http://www.somewhere.com/" then add the textbox text so it becomes:"http://www.somewhere.com/thislink"

"System.Diagnostics.Process.Start(URL);" Then tell you program to start a process going to this url, which will open your default browser and navigate there


Hope That Helped. :)
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#3
freddyw2

freddyw2

    Newbie

  • Members
  • PipPip
  • 12 posts
Thanks gamemaker.

Was really helpful.

#4
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts

Quote

Thanks gamemaker.

Was really helpful.
Your welcome, glad I could help! :)
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.