Ichikuma's blog

生活實況紀錄

By

Inspiron 1420

Today, my new notebook, Inspiron 1420, has arrive.

It is Windows Vista box. Actully, l want to tested out some program with Vista long time ago. (Althought many people still saying that Vista got many problem with some application). But, for developer, I think I need to try it, and get experience with it.

Now, I am planning what I will do with me new baby now. 🙂

By

dasblog upgraded to 2.0.7226.0

Now my current version dasBlog is 2.0.7226.0. 🙂

By

Bind DLINQ to DataGridView

This morning I try to find a method to bind DLINQ to DataGridView. There don’t have ToBindingList in DLINQ DataQuery. Need to manually import System.Data.Dlinq.DataQueryExtensions in the top of form

	Imports System.Data.Dlinq.DataQueryExtensions

After that, the method ToBindingList() will come out.

        Dim sConnectString As String = "data source=.\SQLEXPRESS;" & _
                 "Integrated Security=SSPI;AttachDBFilename=D:\Data\Northwind.mdf;" & _
                 "User Instance=true"
        Dim db As New Northwind(sConnectString) 

        Dim cust = From c In db.Customers _
                 Select c

        DataGridView1.DataSource = cust.ToBindingList()
        DataGridView1.Refresh()

So now, I can modify this to bind the DataQuery to BindingSource for my form.

By

VB.NET LINQ == RUBY?

I have write a simple program in VB.Net LINQ and Ruby, which product the result is same. If you study the code both syntax almost same. I think nowaday all programming langauge is going to ruby-like programming language (easy to understand and real object-oriented programming).

VB.Net

Dim v as Integer
Dim numbers As Integer() = New Integer() {1, 4, 2, 7, 8, 9}
Dim evenNumbers = From p In numbers _
       Where (p Mod 2) = 0 _
       Select P
For Each v In evenNumbers
   System.Console.WriteLine(v)
Next

Ruby

numbers = [1,4,2,7,8,9]
evenNumbers = Array.new
numbers.each do |p|
 evenNumbers<<p if (p % 2) == 0
end
evenNumbers.each {|p| print p}

By

Happy New Year

Happy New Year