read analog input arduino in visual basic 2010 with ethernet

Hi,i,m new with arduino and here i want to read analog input of my arduino to visual basic 2010 with ethernet,but igot an error mesage when i want to see it in label
Here is my arduino code

[#include <SPI.h>
#include <Ethernet.h>

//*************************************************************************************************************************************
// Wired configuration parameters
//*************************************************************************************************************************************
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xD1, 0x4B };
unsigned char local_ip[] = {192,168,1,8};	// IP address of WiShield
unsigned char subnet_mask[] = {255,255,255,0};	// subnet mask for the local network

EthernetServer server(12);

//char buffer[20];
String buffer = "";

void setup()
{
  Ethernet.begin(mac, local_ip);
  Serial.begin(9600);
}

void loop()
{
  EthernetClient client = server.available();
  if (client) 
  {
    boolean currentLineIsBlank = true;  
    while (client.connected()) 
    {
      if (client.available()) 
      {
        char c = client.read();
        Serial.print(c);   
        buffer+=c;
        
        int sensepin;
        
        if (c == 'O')
        {
        sensepin=analogRead(A0);
        String s=String(sensepin);
        Serial.println(s);
        }
        delay(100);
      }
    }
  }
}
       ]

and here is my visual studio code
[code][Imports System.Net.Sockets
Imports System.Text


Public Class Form2
    Dim tcpClient As New System.Net.Sockets.TcpClient()
    Dim networkStream As NetworkStream
    Dim KeyPressed As Integer

    Private Function Arduino_Connect(ByVal IP As String, ByVal Port As Integer) As Boolean
        tcpClient.Connect(IP, Port)
        networkStream = tcpClient.GetStream()
        If Not networkStream.CanWrite Or Not networkStream.CanRead Then
            tcpClient.Close()
            networkStream = Nothing
            Return False
        End If
        Return True
    End Function
    Private Sub Arduino_Write(ByVal Output As String)
        If Not IsNothing(networkStream) Then
            Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(Output)
            Dim endByte As [Byte]() = {&HFE}
            networkStream.Write(sendBytes, 0, sendBytes.Length)
            networkStream.Write(endByte, 0, 1)
        Else
            MsgBox("ERROR")
        End If
    End Sub
    Private Sub Arduino_Disconnect()
        If Not IsNothing(networkStream) Then
            tcpClient.Close()
            networkStream = Nothing
        End If
    End Sub
    Private Sub Form2_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Arduino_Connect("192.168.1.8", 12)
    End Sub
  
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
    End Sub


    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Arduino_Write("E")
        Dim data As String
        Try
            data = SerialPort1.ReadLine
            Label1.Text = data
        Catch ex As Exception
        End Try

    End Sub
End Class]
in visual studio i got an error in data=serialport1.readline,i know i must must change this code because i use ethernet not serial,but i don't know what code should i change,can anyone help me?
I really appreaciate any help,thanks

[/code]

What is this mysterious error message and where is it coming from ? Arduino or VB ?

Do you mean that you want to send the value read by the Arduino to VB ?
If so, which part of the Arduino code sends the value read to VB ?

it comes from vb,it appear message box error
Yes,i want to send the value of analog input in arduino to show it in vb
the code is like this

[void loop()
{
  EthernetClient client = server.available();
  if (client) 
  {
    boolean currentLineIsBlank = true;  
    while (client.connected()) 
    {
      if (client.available()) 
      {
        char c = client.read();
        Serial.print(c);   
        buffer+=c;
        
        int sensepin;
        
        if (c == 'O')
        {
        sensepin=analogRead(A0);
        String s=String(sensepin);
        Serial.println(s);
        }
        delay(100);
      }
    }
  }
}]

it comes from vb,it appear message box error

So, where IS the error? Why do you assume that, since VB is having an error, that the Arduino code (incomplete at that) is at fault?

Where is your error-producing VB code?

        int sensepin;
        
        if (c == 'O')
        {
        sensepin=analogRead(A0);
        String s=String(sensepin);
        Serial.println(s);
        }

The Serial.println() method does not need your "help" in converting an int to a string. It is perfectly capable of doing it itself. All that code could be replaced by:

        if (c == 'O')
        {
             Serial.println(analogRead(A0));
        }

and use less memory AND be faster.

Finally, if the request comes from a client, why doesn't the answer go back to the client?

thx for the help
i already code the arduino,but i want to show the value in vb.net.here is my code in vb.net
I always get an messagebox error,i think its because my code is wrong,it can't write the arduino code,im stuck with this vb code.

Imports System.Net.Sockets
Imports System.Text


Public Class Form2
    Dim tcpClient As New System.Net.Sockets.TcpClient()
    Dim networkStream As NetworkStream
    Dim KeyPressed As Integer

    Private Function Arduino_Connect(ByVal IP As String, ByVal Port As Integer) As Boolean
        tcpClient.Connect(IP, Port)
        networkStream = tcpClient.GetStream()
        If Not networkStream.CanWrite Or Not networkStream.CanRead Then
            tcpClient.Close()
            networkStream = Nothing
            Return False
        End If
        Return True
    End Function
    Private Sub Arduino_Write(ByVal Output As String)
        If Not IsNothing(networkStream) Then
            Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(Output)
            Dim endByte As [Byte]() = {&HFE}
            networkStream.Write(sendBytes, 0, sendBytes.Length)
            networkStream.Write(endByte, 0, 1)
        Else
            MsgBox("ERROR")
        End If
    End Sub
    Private Sub Arduino_Disconnect()
        If Not IsNothing(networkStream) Then
            tcpClient.Close()
            networkStream = Nothing
        End If
    End Sub
    Private Sub Form2_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Arduino_Connect("192.168.1.8", 12)
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.TextChanged
        Arduino_Write("E")
    End Sub
End Class

Would you not be better off asking this question in a VB forum ?

I'm going to make one last attempt to help you, before I write you off as helpless.

WHAT IS THE ERROR?