Z
zw2000
Hi,
I have read a few articles regarding the slow speed of vb.net
application, did a little experiment myself. It's a simple multiple
loop here are the code in vb.net and vb6
vb.net:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim A0 As Short
Dim A1 As Short
Dim A2 As Short
Dim A3 As Short
Dim A4 As Short
Dim A5 As Short
Dim Count As Integer = 0
For A0 = 1 To 45
For A1 = A0 + 1 To 46
For A2 = A1 + 1 To 47
For A3 = A2 + 1 To 48
For A4 = A3 + 1 To 49
For A5 = A4 + 1 To 50
Count += 1
Label1.Text = Count
Label1.Refresh()
Next
Next
Next
Next
Next
Next
Label1.Text = Count
Label1.Refresh()
End Sub
vb6:
Private Sub Command1_Click()
Dim count As Long
Dim A0 As Integer
Dim A1 As Integer
Dim A2 As Integer
Dim A3 As Integer
Dim A4 As Integer
Dim A5 As Integer
count = 0
For A0 = 1 To 45
For A1 = A0 + 1 To 46
For A2 = A1 + 1 To 47
For A3 = A2 + 1 To 48
For A4 = A3 + 1 To 49
For A5 = A4 + 1 To 50
count = count + 1
Label1.Caption = count
Label1.Refresh
Next
Next
Next
Next
Next
Next
Label1.Caption = count
Label1.Refresh
End Sub
The results are shocking. It only took about 3 minutes for vb6
application to finish the loop. For vb.net, didn't even finish the loop
in 15 minutes, I lost patience, close the program anyway. Don't know
how long it would actually take.
I'm just a beginner on VB, couldn't figure out why. Can anybody explain
to me, thank u.
I have read a few articles regarding the slow speed of vb.net
application, did a little experiment myself. It's a simple multiple
loop here are the code in vb.net and vb6
vb.net:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim A0 As Short
Dim A1 As Short
Dim A2 As Short
Dim A3 As Short
Dim A4 As Short
Dim A5 As Short
Dim Count As Integer = 0
For A0 = 1 To 45
For A1 = A0 + 1 To 46
For A2 = A1 + 1 To 47
For A3 = A2 + 1 To 48
For A4 = A3 + 1 To 49
For A5 = A4 + 1 To 50
Count += 1
Label1.Text = Count
Label1.Refresh()
Next
Next
Next
Next
Next
Next
Label1.Text = Count
Label1.Refresh()
End Sub
vb6:
Private Sub Command1_Click()
Dim count As Long
Dim A0 As Integer
Dim A1 As Integer
Dim A2 As Integer
Dim A3 As Integer
Dim A4 As Integer
Dim A5 As Integer
count = 0
For A0 = 1 To 45
For A1 = A0 + 1 To 46
For A2 = A1 + 1 To 47
For A3 = A2 + 1 To 48
For A4 = A3 + 1 To 49
For A5 = A4 + 1 To 50
count = count + 1
Label1.Caption = count
Label1.Refresh
Next
Next
Next
Next
Next
Next
Label1.Caption = count
Label1.Refresh
End Sub
The results are shocking. It only took about 3 minutes for vb6
application to finish the loop. For vb.net, didn't even finish the loop
in 15 minutes, I lost patience, close the program anyway. Don't know
how long it would actually take.
I'm just a beginner on VB, couldn't figure out why. Can anybody explain
to me, thank u.