Ciao a tutti
Sto provando a creare una piccola applicazione in vb.net ma ho dei seri problemi arrivando da vb6(che già sapevo usare molto poco...)
Dovrei ottenere un grafico che si aggiorna in tempo reale da dei valori prelevati da una stringa di testo.
Ho cercato in rete e sono arrivato a questo punto:
i dati vengono passati tramite rs232 da uno strumento di misura che restituisce flusso e temperatura di un fluido,lo scopo e di creare un grafico stile termometro che si aggiorna in tempo reale con i 2 valori,magari avere la possibilita tramite un pulsante di scegliere 2 grafici diversi,tipo 2 barre verticali o curva tipo sinusoide.

contenuto text1:Flow[l/h]: +0.00 Temp[C]: +21.2,
contenuto text2:33
contenuto text3:212
contenuto text4:0

codice:
Imports ZedGraph
Imports System.IO.Ports

Public Class Form1
    Dim WithEvents serialPort As New IO.Ports.SerialPort

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        CreateGraph_GradientByZBars(z1)
        With SerialPort1
            .BaudRate = 19200
            .DataBits = 8
            .Parity = Parity.None
            .StopBits = StopBits.One
            .ReceivedBytesThreshold = 1
            .Handshake = Handshake.None
            .Encoding = System.Text.Encoding.Default
            .Open()
        End With

    End Sub

    Private Sub DataReceived( _
      ByVal sender As Object, _
      ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
      Handles SerialPort1.DataReceived

        TextBox1.Invoke(New  _
        myDelegate(AddressOf updateTextBox), _
        New Object() {})
    End Sub


    Public Delegate Sub myDelegate()
    Public Sub updateTextBox()
        Dim Strdata As String
        'Dim Strflow As String
        Dim posvirgola As Integer
        Dim chrfine As String
        Dim flusso As Integer
        Dim temp As Integer

        chrfine = ","
        Strdata = SerialPort1.ReadLine
        posvirgola = InStr(Strdata, chrfine)


        


        temp = Strdata.Substring(posvirgola - 5, 4)
        flusso = Strdata.Substring(posvirgola - 21, 5)

        TextBox1.Text = Strdata
        TextBox2.Text = posvirgola 'Strflow
        TextBox3.Text = temp
        TextBox4.Text = flusso


    End Sub
    Private Sub CreateGraph_GradientByZBars(ByVal z1 As ZedGraphControl)
        Dim myPane As GraphPane = z1.GraphPane
        myPane.Title.Text = "Gestione flusso e temperatura"
        myPane.XAxis.Title.Text = "Temp"
        myPane.YAxis.Title.Text = "C°"

        Dim list As New PointPairList()
        list.Add(0, 6000, 100)
        Dim myCurve As BarItem = myPane.AddBar("legenda", list, Color.Red)


        myPane.Chart.Fill = New Fill(Color.White, Color.FromArgb(220, 220, 255), 45) 'sfondo interno grafico
        myPane.Fill = New Fill(Color.White, Color.FromArgb(255, 255, 225), 45) 'sfondo esterno grafico
        ' Tell ZedGraph to calculate the axis ranges
        z1.AxisChange()
    End Sub 'CreateGraph_GradientByZBars 

End Class
Non riesco a capire come dare un valore alla barra che e della lunghezza del valore impostato in list.
Sinceramente ci capisco ancora molto poco di vb.net e nemmeno con wikizedgraph sono riuscito a capire...
Grazie a tutti