Controlling a servo with a joystick via serial

I'm trying to control the position of a servo with a joystick connected through the PC with a serial connection. I've got a very shaky connection with the code below, but the servo responds very unstably only within the joystick values of approximately 80 and 180; smaller than 80 and it doesn't respond, above 180 and it resets to its minimum position. Is there a more reliable way to control the servo? (The extra serial values are for different inputs not directly related to the servo control but necessary for the rest of the project, and the comments are in general not related.)

I've found this site, but it's using Python whereas I'm using Visual Basic to get the joystick settings. Any way I could adapt the arduino sketch on that page to Basic?

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott http://people.interaction-ivrea.it/m.rinott

#include <Servo.h>

Servo myservo; // create servo object to control a servo

int incomingByte0 = 0; // for reverse
int incomingByte1 = 0; // for forward
int incomingByte2 = 0; // for left
int incomingByte3 = 0; // for right
int incomingByte4 = 0; // for up
int incomingByte5 = 0; // for down
int incomingByte6 = 0; // for pivot left
int incomingByte7 = 0; // for pivot right
int incomingByte8 = 0; //
int incomingByte9 = 0;
int incomingByte10 = 0;
int incomingByte11 = 0;
int incomingByte12 = 0;
int incomingByte13 = 0;
int incomingByte14 = 0;
int val; // variable to read the value from the analog pin

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(19200); // opens serial port, sets data rate)
}

void loop()
{
if (Serial.available() > 0) {incomingByte0 = Serial.read();}
if (Serial.available() > 0) {incomingByte1 = Serial.read();}
if (Serial.available() > 0) {incomingByte2 = Serial.read();}
if (Serial.available() > 0) {incomingByte3 = Serial.read();}
if (Serial.available() > 0) {incomingByte4 = Serial.read();}
if (Serial.available() > 0) {incomingByte5 = Serial.read();}
if (Serial.available() > 0) {incomingByte6 = Serial.read();}
if (Serial.available() > 0) {incomingByte7 = Serial.read();}
if (Serial.available() > 0) {incomingByte8 = Serial.read();}
if (Serial.available() > 0) {incomingByte9 = Serial.read();}
if (Serial.available() > 0) {incomingByte10 = Serial.read();}
if (Serial.available() > 0) {incomingByte11 = Serial.read();}
if (Serial.available() > 0) {incomingByte12 = Serial.read();}
if (Serial.available() > 0) {incomingByte13 = Serial.read();}
if (Serial.available() > 0) {incomingByte14 = Serial.read();}

if ((incomingByte13 == 255) && (incomingByte14 == 255)){
val = (incomingByte4 * (180/255)); // reads the value of the potentiometer (value between 0 and 1023)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
}

Try val = (incomingByte4 * 180) / 255));