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).

AddThis

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...

Events coming up

  • Dec 6

    Developing AJAX Web Applications with Castle Monorail

    London, United Kingdom

    Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!