Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How to make XP Style Buttons in your VB.Net Application.

Author: DevASP
Download Source Code : 364_XP_STYLE_BUTTONS.zip

In this simple article you will learn that how can you make your buttons style XP Style.

Create a New Project in VB.Net. Drag ten Button controls from tool box . Now write code on Form Load Event and Buttons Click events

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Button1.Text = "Click Me"

        Button2.Text = "Click Me"

        Button3.Text = "Click Me"

        Button4.Text = "Click Me"

        Button5.Text = "Click Me"

        Button6.Text = "Click Me"

        Button7.Text = "Click Me"

        Button8.Text = "Click Me"

        Button9.Text = "Click Me"

       

End Sub

 

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Button1.FlatStyle = FlatStyle.System

 

End Sub

 

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

 

        Button3.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

 

        Button9.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

 

        Button8.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

 

        Button6.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

 

        Button2.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

 

        Button4.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

 

        Button7.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

 

        Button5.FlatStyle = FlatStyle.System

 

End Sub

 

 

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

 

        Button1.FlatStyle = FlatStyle.Standard

        Button2.FlatStyle = FlatStyle.Standard

        Button3.FlatStyle = FlatStyle.Standard

        Button4.FlatStyle = FlatStyle.Standard

        Button5.FlatStyle = FlatStyle.Standard

        Button6.FlatStyle = FlatStyle.Standard

        Button7.FlatStyle = FlatStyle.Standard

        Button8.FlatStyle = FlatStyle.Standard

        Button9.FlatStyle = FlatStyle.Standard

     

End Sub

Article Comments
I am doing a project in ASP.NET(C#)
& using XP O.S.
in some of forms buttons look like XP style
but some of forms buttons look lke normal(like in Win 98)
could u help me ?

Posted on 3/28/2007 6:58:05 AM by Mandar

This is great and very simple to use.

However is there a way to make it always default to the standard XP 'Blue' Theme styled buttons instead of just what theme you may have applied at the time.

I guess what I am looking for is a button control for each theme, that can be used whenever.

Posted on 1/31/2008 4:00:24 PM by Julian Pool

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to Get Current Window User Name

Disclaimer - Privacy
© 2002-2017 DevASP.net