Welcome  everyone Namaste My blog praveen hirachan Nepal Japan

Thursday, April 17, 2014

How to make "web browser using C#"..

This video is a tutorial on "how to make Web browser  using C#". Lots of  programmer in their starting phase wants to create their own personal web browser  where they can create their own programs and setup the things and button as they wants. For those programmer, who wants to create web browser  but have no idea where to start. If you are one of those seeking the first starting point,then I must say this is the right place to start. Below, I have posted my video. watch and subscribe my channel. SUBSCRIBE


My code while making my personal Web browser

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 Browser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void GoButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(UrlTextBox.Text) ||
                UrlTextBox.Text.Equals("about:blank"))
            {
                MessageBox.Show("Enter a valid URL.");
                UrlTextBox.Focus();
                return;
            }
            OpenURLInBrowser(UrlTextBox.Text);
        }

        private void OpenURLInBrowser(string url)
        {
            if (!url.StartsWith("http://") &&
                !url.StartsWith("https://"))
            {
                url = "http://" + url;
            }
            try
            {
                webBrowser1.Navigate(new Uri(url));
            }
            catch (System.UriFormatException)
            {
                return;
            }
        }
        private void HomeButton_Click(object sender, EventArgs e)
{
    webBrowser1.GoHome();
}

private void BackButton_Click(object sender, EventArgs e)
{
    if (webBrowser1.CanGoBack)
        webBrowser1.GoBack();
}
private void NextButton_Click(object sender, EventArgs e)
{
    if (webBrowser1.CanGoForward)
        webBrowser1.GoForward();
}
private void RefreshButton_Click(object sender, EventArgs e)
{
    webBrowser1.Refresh();
}
private void SaveButton_Click(object sender, EventArgs e)
{
    webBrowser1.ShowSaveAsDialog();
}
private void PrintPreviewButton_Click(object sender, EventArgs e)
{
    webBrowser1.ShowPrintPreviewDialog();
}
private void PrintButton_Click(object sender, EventArgs e)
{
    webBrowser1.ShowPrintDialog();
}
private void PropertiesButton_Click(object sender, EventArgs e)
{
    webBrowser1.ShowPropertiesDialog();
}


   
    }
}




No comments:

Post a Comment

Popular Posts