Today, I was trying visual basic express 2008. It’s free version from Microsoft but still powerful for creating simple software. As we know, Microsoft says in Visual Studio 2008 had new feature like LinQ. LinQ is code template like SQL Query but it’s more powerful. LinQ make us easier to query database, array, and even variables.
Okay let’s try it. This is my first try and if I got it wrong, feel free to tell me at the comment side.
To begin the first project, you need Visual Basic Express 2008, which you can download at: http://www.microsoft.com/express/vb/
Let’s begin to rock VB Express 2008. :)
1. Open your VB Express 2008
2. Choose ConsoleApplication and choose “OK” button.
3. Create a simple sub procedure like this:
Sub NumQuery()
Dim numbers() = {1, 4, 2, 7, 8, 9}
Dim evenNumbers = From num In numbers Where num Mod 2 = 1 Select num
Console.WriteLine("Result :")
For Each number In evenNumbers
Console.WriteLine(number)
Next
Console.ReadKey()
End Sub
4. Then, in “Sub Main()”, write this code like this:
Sub Main()
NumQuery()
End Sub
5. Done… hehehe
You can see at this line of code:
Dim evenNumbers = From num In numbers Where num Mod 2 = 1 Select num
Which it mean: we choose data from numbers and place in the num variable where the condition num mod 2 = 1, and last the result of num will place on evenNumbers variable.
For Each number In evenNumbers
Console.WriteLine(number)
Next
Those codes will execute and display the result in console mode.
What do you think about this new feature of Visual Basic Express 2008. :)
Have a nice day.









0 comments:
Post a Comment