The reason is very simple.You can't open serial port at VB and simultaneously on arduino IDE!
Serial port becomes busy after gets opened.For you could see the result of sending the "ABC" from VB, just put a textbox in VB a make arduino code to send it back to you and fill the textbox with incoming data from the Serial.Like an eco you send ABC to arduino, arduino reads it and send it back to you showing on the VB textbox.
If this is more trouble for you to do then simply try to highlight onboard LED placed on pin 13 when the incoming string matches.
Some thing like this will work:
//You need space for the null terminator, since you want 3 characters you need an extra to the null terminator 3+1
#define STR 4
char buffer[STR];
//--------------------------------------------------
void setup(){
Serial.begin(9600);
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
}
//---------------------------------------------------
void loop(){
if (Serial.available() <0) { //Ok if you dont have nothing print like crazy ...
Serial.print("Empty");
delay(1000);
}
if (Serial.available() >=3) {//It will need 3 bytes to run, this way you insure it's safe to read the 3 bytes in a while loop
//Serial comunication are very slow, if you try to read the 3 bytes when you detect the first one you will not get the next because the second one hasn't arrived yet
int i = 0;
while (i <= 2) {
Serial.print(i);
buffer[i++] = Serial.read();//Use i and then increment it after
}
buffer[3] = '\0';//In order to print it below like a string you need to terminate the char array with a 0
Serial.print("OK I received");
if (strcmp(buffer, "ABC") == 0 ){//If the string match turn LED on about 2 seconds and turn it off again
digitalWrite(13,HIGH);//
delay(2000);
digitalWrite(13,LOW);
}
Serial.println(buffer); //Here you should get the string correctly
}
}