This article will show you how you can load the specified
url using webbrowser control in windows application using c#.net.
Some of my previous articles are as follows: Change
Control Font Size At Runtime / Dynamically Using C#.Net and VB.Net In Windows
Application, Export
GridView Data To Excel Sheet Using C#.Net In Windows Application, Windows
Application In C#.Net (My first video article on youtube.com), How
to Create a Code 128 Barcode Label Using windows Font in C# ,Windows Application,
How
To Get Enumerate Installed Fonts List In Your Computer Using C# Windows
Application, Blinking
Text in C#.Net Windows Application, Copy
File In C# Windows Application.
So for this article first we will create a new windows
application and add the below code.
Here is the code.
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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
/// <summary>
/// How to Draw Text at a Specified Location
/// </summary>
/// <param
name="sender"></param>
/// <param
name="e"></param>
private
void button1_Click(object
sender, EventArgs e)
{
if
(textBox1.Text != "")
{
webBrowser1.Url = new System.Uri(textBox1.Text,
System.UriKind.Absolute);
}
else
{
MessageBox.Show("Please enter URL");
}
}
}
}
|
In above code I have provided the url in tetbox which will
open in webBrowser control. Now we have done run the application to check the
output.
Suprb.
ReplyDeleteSuprb.
ReplyDeleteThanks for your valuable comment.
Delete