Storing of points

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tigger
    New Member
    • May 2007
    • 37

    #1

    Storing of points

    Hi

    I have a problem trying to store points. Each time plotButton is click, a point is plotted. I need to store the particular point as a variable so that it can be saved as a text file. And later on, when user open up the file again, it will automatically reads the points and plot them in place.

    Here's my code for the plotting of points.

    Code:
    Private Sub plotButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plotButton.Click, PlotToolStripMenuItem.Click
    
                 If Me.count = 0 Then
                    Audiogram.mypts.Add(New Point(104, 74))
                 ElseIf Me.count = 5 Then
                    Audiogram.mypts.Add(New Point(104, 86))
                 ElseIf Me.count = 10 Then
                    Audiogram.mypts.Add(New Point(104, 98))
                 End If
    End Sub
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Just store an array of X/Y coordinates. You can save them to a file, and when you read them back, just pass them all to the "add a point" routine the same as if they were clicked.

    Comment

    • tigger
      New Member
      • May 2007
      • 37

      #3
      Originally posted by Killer42
      Just store an array of X/Y coordinates. You can save them to a file, and when you read them back, just pass them all to the "add a point" routine the same as if they were clicked.

      Code:
      Audiogram.mypts.Add(New Point(104, 50))
      We want to store these lines of code (which is declared as graphic) into an array (for eg. savePoint). But we don't know to declare SavePoint as what.. Single,Double etc? Cos graphics cannot be converted into Single or Integer. 'Expression does not produce a value' error will appear.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by tigger
        Code:
        Audiogram.mypts.Add(New Point(104, 50))
        We want to store these lines of code (which is declared as graphic) into an array (for eg. savePoint). But we don't know to declare SavePoint as what.. Single,Double etc? Cos graphics cannot be converted into Single or Integer. 'Expression does not produce a value' error will appear.
        I believe you only need to store the relevant information, which would be the 104 and the 50. You should be able to recreate the point from that.

        Comment

        Working...