Solved

Remove Item from class object

Posted on 2012-03-11
2
274 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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