Solved

Remove Item from class object

Posted on 2012-03-11
2
270 Views
Last Modified: 2012-03-11
I have a Class which is declared as:

Imports System.ComponentModel

Public Class PendingDel
    Implements INotifyPropertyChanged
#Region "INotifyPropertyChanged Members"

    Public Event PropertyChanged As PropertyChangedEventHandler _
       Implements INotifyPropertyChanged.PropertyChanged

    Private Sub OnPropertyChanged(propertyName As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))

    End Sub

#End Region

Private m_JobNum As String
    Public Property JobNum As String
        Get
            Return m_JobNum
        End Get
        Set(value As String)
            If Me.m_JobNum <> value Then
                Me.m_JobNum = value
                Me.OnPropertyChanged("JobNum")
            End If
        End Set
    End Property

Private m_Driver As String
    Public Property Driver() As String
        Get
            Return Me.m_Driver
        End Get
        Set(value As String)
            If Me.m_Driver <> value Then
                Me.m_Driver = value
                Me.OnPropertyChanged("Driver")
            End If
        End Set
    End Property
End Class

I have declared a new collection at class level
Public Shared itemsSource As New ObservableCollection(Of Object)()

I am adding new items to the class using:
Public Sub loadDriverJobs()
        itemsSource.Add(New PendingDel() With { _
                             .JobNum = 1, _
                             .Driver = "Bob"})
        itemsSource.Add(New PendingDel() With { _
                             .JobNum = 2, _
                             .Driver = "Ian"})
    End Sub

How would I remove the JobNum 2 from the class, I have looked at different examples but can’t find how to achieve this, any help would be appreciated.
0
Comment
Question by:JoeBo747
2 Comments
 
LVL 5

Accepted Solution

by:
Aruiz04 earned 500 total points
ID: 37708191
itemsSource.RemoveAt(1)
0
 
LVL 1

Author Closing Comment

by:JoeBo747
ID: 37708314
Thanks for the reply, I was querying the itemsSource and attempting to remove the item via the returned records! Couldn’t spot the obvious!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now