Hi ritesh18a,
Check this example. Now please take its reference and correct your code.
You need to add System.Windows.Forms reference from the .Net Tab of Add Reference window.
HTML
<asp:Label ID="label1" Text="Welcome to ASP Forums." runat="server" />
<br />
<asp:Button Text="Change Font" runat="server" OnClick="Change" />
Namespace
C#
using System.Windows.Forms;
VB.Net
Imports System.Windows.Forms
Code
C#
protected void Change(object sender, EventArgs e)
{
FontDialog fontDialog1 = new FontDialog();
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
label1.Font.Name = fontDialog1.Font.Name;
}
}
VB.Net
Protected Sub Change(ByVal sender As Object, ByVal e As EventArgs)
Dim fontDialog1 As FontDialog = New FontDialog()
If fontDialog1.ShowDialog() = DialogResult.OK Then
label1.Font.Name = fontDialog1.Font.Name
End If
End Sub
Screenshot