Library code snippets

VB.NET Stylise Your Forms like you would with CSS on a webpage

Code

Sub Stylize(frm As Form)
 Dim Con As Control
 For i = 0 To frm.Controls.Count - 1
                Con = frm.Controls(i)
                If TypeOf Con Is TextBox Then Con.ForeColor = Color.Red
                If TypeOf Con Is Button Then Con.FlatStyle = FlatStyle.Flat
 Next
End Sub

This is just an example, setting textbox's forecolor to Red, and buttons style to Flat.

Comments

  1. 06 Jan 2007 at 23:40
  2. 11 Sep 2006 at 16:13
    So, how to do that with a dialog box?

  3. 01 Jan 1999 at 00:00

Leave a comment

Sign in or Join us (it's free).

 phill64

Related podcasts

  • Episode 3: Anne van Kesteren on CSS, XHR, and other Web standards

    Anne van Kesteren is an Opera Software employee who is deeply involved in the standards community. Just take a look at his page on the WHATWG site and you will see the many specifications that he is actively working on, such as: access-control XMLHttpRequest XMLHttpRequest2 cssom-view css3-media...

We'd love to hear what you think! Submit ideas or give us feedback