how do i format serial input(string).

Archit

Member
Joined
Jan 12, 2010
Messages
10
Programming Experience
1-3
Hi to all...
i am working on my collage project in which i have an "sensor" which detects weights.
specifications : (COM1,2400,N,8)

I have added two components Timer and Serialport and set the values
timer duration =1000 and added a button and textbox.

when user clicks on the button timer1 gets started.
and in timer1 i added the code which reads the input from serial.

now the problem with the code. the input which i receive is in ASCII formats(actually some of chars are in ascii format).
This is the output i m getting :-  029990

so i created a string variable which stores this value.
actually i want only number from that string
ex :  029990 ===> 029990
but i m unable to retrieve that.:mad:

here is my code it is working ....
HTML:
 If SerialPort1.IsOpen = True Then
            SerialPort1.Close()
        End If

        SerialPort1.Open()

        Dim a As String
        a = SerialPort1.ReadLine()
         a = a.Substring(2, 6) 'formats the string.
          textbox1.text=a

i want to format and convert this string into integer format for some more calculation.

Note : the  029990 the first and the last ASCII chars always remains the same, but numbers inside it may be vary form 0 to 999999.
 
Back
Top