Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remove Item from class object

Posted on 2012-03-11
2
Medium Priority
?
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
Aruiz04 earned 2000 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

730 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