Visual studio 2012 serial port connection to Arduino

I'm using visual studio 2012 and implementing a test code to try to figure out why my Arduino isn't receiving any of the data I send. I am using an Arduino zero. I also have tried an Arduino uno, Arduino pro mini and Arduino micro and can try with any of them instead of the Arduino zero if it helps.

I am using a code format from online. When I run the code my led always remains on, indicating that serial.available = 0. I can't open serial monitor while my program is running either as the serial port is busy, which agrees with the lack of available ports.

int incomingByte = 0;   // for incoming serial data
int ledPin = 13; 
void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();
                digitalWrite(ledPin, LOW);
        }
        else digitalWrite(ledPin, HIGH); 
}

I don't have my computer with the c++ code on me right now, but will post it tomorrow morning.
The basic format was

Serial * s = new Serial(COM port);

if(s->isConnected){
s->writeData(char_variable, 1); 
//print out test code to see data being transmitted
}

Could someone offer some ideas for why this isn't working? Do I need to send a start bit or something to start serial port communications? Is there a proper SerialClass.h and serial.cpp I should be using?

I have same problem like you before, i can't connect to my Arduino Uno. But i'm using VB6 classic. This VB6 code not guarantee 100% bullet proof for VS 2012, but you can read the term they used.

I think VS 2012 is like 'similar' with VB6.

(Bol)

Did you use Windows control panel (etc) to see which COM port that the arduino got automatically assigned with? The computer will assign a com port number to the arduino when you connect the arduino to the computer. Control panel can then be used to see which com port was assigned.

Eg... COM6.

Then, in the C software code, or whatever, do something like...

Serial* SP = new Serial("COM6");

So within the brackets above, include the double quotes as well... ie ("COM6")

The number you use will depend on what com port was assigned automatically to the arduino.

(deleted)