Entries Tagged as 'Technical'

What is this VB.NET?!

Salam 3lykom

 

When you try to do something, First  calculate how much are the Benefits / Harms.

 

Actually I’m disappointed and still wondering how can VB developers avoiding some thing like that!

 

Two weeks ago , I discovered a bug  in Visual Basic Language itself ! … Really I was so excited to find out the bug and configure some solutions ! and this is my post on MSDN forum :

 Hello all ,I discovered that error by chance when I was working on Collections. But I found it in FOR loop in VB.Net.Have a Look :

Sub Main()  

        Dim Y As Integer = 10  

        For x As Integer = 0 To Y  

            Console.WriteLine(x.ToString())  

            Y = Y - 1  

        Next  

        Console.ReadLine()  

End Sub 

‘and the result was 

10 

‘and that is not logically correct !! 

‘the Correct result should be : 

‘as Y decreased every step. 

In other words : why FOR loop limit is not updated every step!!!! ? Is it a Bug or What ?!thanks in advance !!  

url : http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/e7b47ed3-834e-4e05-8357-00ca92fc8a1f/ 

Frankly , replies were very disappointing :S , All were about “We cann’t Change anything ! ” or “You can use another way !!”.

 

I think the bug is very basic/essential , how can they avoid it like that !

 Only the positive reply was from Jonathan Aneja , VB Team Manager :D !!

 

Hi there,

 

This behavior is by design, as documented in the help topics. VB has several different looping constructs that provide a lot of flexibility here - in this case you could use a “Do While” or “Loop Until” if you want the ability to dynamically change the upper bound.

 

I’m going to resolve this bug as “by design” for now, but if you have any questions feel free to contact me directly at jonathan DOT aneja AT microsoft DOT com.

 

Thanks,

 

Jonathan Aneja

Program Manager, VB Team

 

the only excuse I can consider it , that they are vb lovers :)

 

but actually I can’t advise anyone to use vb from now !! , I like C-family more :)

 

I have nothing to say now , I just wanted to log it :) !

 

Salam