Shefali,
Create a picture box on the form you are using. We will call it pic1.
Scale the picture box to the required coordinates. Say, your data has a range of -100 to 100, and you wish to display next 1000 readings, you can initialize the picture box in the form load event.
Also, place a command button named cmdRefresh. We will call the com control as comm1.
As you get more readings, you may simply change the x-axis scale. I am sure you will get it.
'declarations
private count as integer
private lastValue as single
'event call backs
public sub form_load()
pic1.autoredraw = true 'you can set it in properties as well
pic1.scale (0,100)-(1000,-100)
drawGrid
'rest of initialization code, like opening com port etc. can go here
end sub
public sub timer1_timer()
dim i as integer
i = val(comm1.input)
'if you need a vertical bar use this
pic1.line (count, 0)-(count, i)
'if you need to draw line graph, use this
pic1.line (count, lastvalue)-(count+1, i)
lastvalue = i
count = count + 1
end sub
private sub cmdRefresh_click()
pic1.cls
count = 0
'no need to reset the last value.
end sub
private sub drawGrid()
dim i as integer
for i = 1 to 1000 step 100
pic1.line (i, 100)-(i, -100)
next
for i = -100 to 100 step 25
pic1.line (0, i)-(1000, i)
next
end sub
Try this code. By the way, what is the end use of the program?
Regards
Uday