Results 1 to 9 of 9

Thread: [RESOLVED] Simple List Question *Solved*

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2013
    Location
    Earth
    Posts
    230

    Resolved [RESOLVED] Simple List Question *Solved*

    Hello!

    This is the first time I am using a list in code. (Still a beginner...) But anyway, something's not right. I created a list of points, and added one to the list, but how can you tell if a list contains that point? I thought List.Contains() could work, but I guess not. Nothing happens when I load up the form. What am I doing wrong? How can I tell if a list contains a point or not?

    Thanks!

    vb Code:
    1. Public Class Form1
    2.  
    3.     Dim PointsList As List(Of Point)
    4.  
    5.     Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    6.  
    7.         Dim TestPoint1 As Point = New Point(0, 0)
    8.         Dim TestPoint2 As Point = New Point(0, 0)
    9.  
    10.         PointsList.Add(TestPoint1)
    11.         If PointsList.Contains(TestPoint2) Then
    12.             Label1.Text = "It worked!"
    13.         End If
    14.  
    15.     End Sub
    16.  
    17. End Class
    Last edited by NinjaNic; Oct 5th, 2014 at 12:10 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width