Hi Catherine,

OK, you need a variable to hold a voltage value (volts), a timer to sample the data at regular intervals (Timer1) and a data structure to collect enough data to draw a curve. I already suggested using a Queue (VoltsQ) to hold the data, because it's ideal for a periodically updated time series. I don't know what maximum positive or negative voltage you can expect but I suppose something like +/-5 volts will do (maxVolts).

You'll collect the data in the timer's Tick sub. I'll assume the timer is set to 100 ms. interval, and you want your curve to show about 4 seconds of data; in that case the queue needs to hold up to 40 readings. You can change these numbers to alter the display as you wish.
vb.net Code:
  1. Dim volts As Single
  2. Dim voltsQ As New Queue(Of Single)
  3. Dim maxVolts As Single = 5
  4.  
  5. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  6.        'read the voltage:
  7.        volts = 'get value from RS232 interface
  8.  
  9.         'add the new reading to the end of the queue:
  10.         voltsQ.Enqueue(volts)
  11.  
  12.         'remove the old reading at the head of the queue, to keep max. 40 data points:
  13.         If voltsQ.Count > 40 Then voltsQ.Dequeue()
  14.  
  15.         'update the display with the new data:
  16.         Me.Refresh
  17.     End Sub

In the last code you posted, you used a Graphics.DrawCurve state to draw a smooth line through an array of 4 predefined points. Instead, we want to draw the curve through the 40 data points collected in the queue. Since they are updated 10 times a second, it will appear as a moving waveform. The question is, how do you convert the Queue(Of Single) into the Array(Of Point) required by DrawCurve? In fact it is mainly arithmetic, based on the sizes of the the x and y axes of the graph. For example, you could put this in the Paint sub:

vb.net Code:
  1. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
  2.  
  3.         'Put your code for drawing the axes etc. here.
  4.  
  5.         'Details of the graph layout -- fill in your own values here!
  6.         Dim Origin As New Point(200, 200)
  7.         Dim xAxisLength As Integer = 300
  8.         Dim yAxisLength As Integer = 150
  9.  
  10.         'Define an array of data points:
  11.         Dim DataPoints(voltsQ.Count - 1) As Point
  12.         Dim x, y As Integer
  13.  
  14.         'Fill in the array using the voltage readings:
  15.         For i As Integer = 0 To voltsQ.Count - 1
  16.             'Get the volts value from the queue:
  17.             Dim v As Single = voltsQ.ElementAt(i)
  18.             'Find the distance along the x axis:
  19.             x = Origin.X + CInt(i * xAxisLength / 40)
  20.             'find the height of the data point on the Y axis:
  21.             y = Origin.Y + CInt(v * yAxisLength / maxVolts)
  22.             'Put the point in the array
  23.             DataPoints(i) = New Point(x, y)
  24.         Next
  25.  
  26.         'Draw the waveform:
  27.         e.Graphics.DrawCurve(Pens.Green, DataPoints)
  28.  
  29.     End Sub
I hope the comments in the code explain everything. The important points for VB.Net are the way you use a For-Next loop to build the array. Note too that the maximum index is always Queue.Count-1 because collection indices start from 0 in VB.Net.

bye, BB