Wednesday, January 20, 2010

Get Months English Name

How to populate your dropdownlist with months english name in a fast way?






Imports System.Globalization

Dim intloop As Integer

For intloop = 1 To 12
   
      dropdownlist1.Items.Add(New ListItem(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(intloop - 1), intloop))

Next     





PS:
- Result = a drop down list of months with 1,2,3...12 as value, and January, February, ..... December as Text
- Remember to import class "System.Globalization"
- A New ListItem has to be declared each time when adding item into a drop down list. The first value is the text of the drop down  list item, while the second value is the value of the item.

Monday, January 18, 2010

DateSerial - To Set a Certain Date

To set a certain date and assign it to a variable, u might need this.

Example: Set and assign a variable with the first day of certain month, certain year



Dim dtDate As Date

Dim intYear, intMonth


intYear = 1986
intMonth = 12
dtDate = DateSerial(dtYear, dtMonth, 26)




Now, your dtDate with hold the date of 26th December 1986.

Monday, January 11, 2010

VB Beginner

I started with VB.NET since July 2009 with basic C, C++, HTML, PHP programming languages. Actually with a strong/moderate programming basic and some logical thinking, you can adopt to any new programming language, I believe. Just perhaps need some times to learn and discover the different syntax, programming style and built in functions!

Let's get started!