Serial monitor but not VB?

Greetings, I need to monitor the an output in real time from one of my arduino variable. As always I start with a proof of concept program:

double  i;

void setup() 
{ 
  Serial.begin(9600);
  delay(500);
} 
 
void loop() 
{ 
  for(i=0; i<1024; i+=20)
  {  
    Serial.println(int(i));
    delay(300);
  }  
}

I have this code running in my VB6 timer sub

Private Sub Timer1_Timer()
buffer = MSComm1.Input
    Text2.Text = Text2.Text & buffer & vbCrLf
    Text2.SelStart = Len(Text2.Text) 'focus on bottom of text
buffer = ""
End Sub

But for some reason some of the numbers don’t appear at even intervals, while others get chopped between multiple lines.
If anyone has any ideas I’m open, my biggest conundrum is how does the Serial Monitor avoid this?

But for some reason some of the numbers don't appear at even intervals

Do you mean that the difference between two numbers is not always 20?

Sorry, should have been more clear

I mean sometimes there's 5 seconds between data, when every other time there is 6. And sometimes the data gets broken in half.

Here's a breif printout to show what I mean:

0



20



40


6
0


80



100

Note the difference in time between '40' and '60'

That is partly the nature of serial communication and partly your VB logic

You need to check buffer if it contains input, and only if it does you add it to Text2.text

if Len(buffer) > 0 Then ...

That would you get rid of the empty lines.

A more elaborate version would collect characters until a '\n' or char(13) passes - newline Only at that moment you should add it the VBcrlf

Hopes this helps

Using a double as a loop index, especially when the only use of that index inside the loop is to cast it to an int, is a really lousy idea.