Click here to Skip to main content
15,891,529 members
Home / Discussions / C#
   

C#

 
AnswerRe: TFS 2010 : Email alerts are not working Pin
Pete O'Hanlon2-Dec-12 21:53
mvePete O'Hanlon2-Dec-12 21:53 
QuestionThesis project Pin
khinn Lyndon Samson2-Dec-12 19:46
khinn Lyndon Samson2-Dec-12 19:46 
AnswerRe: Thesis project Pin
Pete O'Hanlon2-Dec-12 21:18
mvePete O'Hanlon2-Dec-12 21:18 
AnswerRe: Thesis project Pin
Abhinav S2-Dec-12 22:05
Abhinav S2-Dec-12 22:05 
QuestionUDF 64bit vs 32bit Excel 2010 Pin
PozzaVecia2-Dec-12 4:39
PozzaVecia2-Dec-12 4:39 
RantRe: UDF 64bit vs 32bit Excel 2010 Pin
Mycroft Holmes2-Dec-12 11:36
professionalMycroft Holmes2-Dec-12 11:36 
GeneralRe: UDF 64bit vs 32bit Excel 2010 Pin
Richard MacCutchan2-Dec-12 21:48
mveRichard MacCutchan2-Dec-12 21:48 
Questiondetermine listbox items origin Pin
User 94041061-Dec-12 11:40
User 94041061-Dec-12 11:40 
Hi,

I'm working on an application of which requires me to have one list-box to hold data.

I'm having a little issue when deleting an object from a list-box. The issue comes into play when I fill the list-box with items from TWO separate lists.

Normally to delete the object I would get it's index and then remove it from the list in a separate class then reload the list-box to reflect the changes but in certain instances I need to fill the list-box with objects from two different lists and determining the origin of the object to delete from one of the two lists, well I'm not entirely sure how to do this.

this code is populating the list-box control.
C#
//clear all items in the listbox
            ViewListBox.Items.Clear();

            //create the lists
            List listOfPickups = visits.listPickups();
            List listOfdeliveries = visits.listDeliveries();
            //populate
            ViewListBox.Items.AddRange(listOfPickups.ToArray());
            ViewListBox.Items.AddRange(listOfdeliveries.ToArray());


this is how i delete when i am only loading the listbox from one list.
C#
if (ViewListBox.SelectedIndex < 0)
{
    EditSelectBtn.Enabled = false;
    DeleteSelectBtn.Enabled = false;
}
else
{
    if (MessageBox.Show("are you sure you want to delete the selected item?", "Are You Sure?", MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        visits.removePickup(this.ViewListBox.SelectedIndex);
        //refresh listbox.
        updateList("pickups");
    }
    else
    {
        //clicked no so do nothing!
        ViewListBox.ClearSelected();
    }
}


Any help would be greatly appretiated.

modified 11-Mar-21 21:01pm.

AnswerRe: determine listbox items origin Pin
Mycroft Holmes1-Dec-12 13:04
professionalMycroft Holmes1-Dec-12 13:04 
AnswerRe: determine listbox items origin Pin
Freak303-Dec-12 0:53
Freak303-Dec-12 0:53 
GeneralRe: determine listbox items origin Pin
User 94041063-Dec-12 9:35
User 94041063-Dec-12 9:35 
Questionhighlight list view Pin
dominioYP1-Dec-12 10:46
dominioYP1-Dec-12 10:46 
AnswerRe: highlight list view Pin
Mycroft Holmes1-Dec-12 13:01
professionalMycroft Holmes1-Dec-12 13:01 
GeneralRe: highlight list view Pin
dominioYP2-Dec-12 1:24
dominioYP2-Dec-12 1:24 
GeneralRe: highlight list view Pin
Mycroft Holmes2-Dec-12 11:31
professionalMycroft Holmes2-Dec-12 11:31 
QuestionApp.Config or Windows Registry? Pin
Jassim Rahma1-Dec-12 10:27
Jassim Rahma1-Dec-12 10:27 
AnswerRe: App.Config or Windows Registry? Pin
Eddy Vluggen1-Dec-12 12:06
professionalEddy Vluggen1-Dec-12 12:06 
GeneralRe: App.Config or Windows Registry? Pin
Jassim Rahma1-Dec-12 18:59
Jassim Rahma1-Dec-12 18:59 
GeneralRe: App.Config or Windows Registry? Pin
Eddy Vluggen1-Dec-12 23:31
professionalEddy Vluggen1-Dec-12 23:31 
AnswerRe: App.Config or Windows Registry? Pin
PIEBALDconsult2-Dec-12 4:28
mvePIEBALDconsult2-Dec-12 4:28 
GeneralRe: App.Config or Windows Registry? Pin
J4amieC2-Dec-12 21:51
J4amieC2-Dec-12 21:51 
GeneralRe: App.Config or Windows Registry? Pin
PIEBALDconsult3-Dec-12 9:08
mvePIEBALDconsult3-Dec-12 9:08 
GeneralRe: App.Config or Windows Registry? Pin
Matty223-Dec-12 18:13
Matty223-Dec-12 18:13 
GeneralRe: App.Config or Windows Registry? Pin
PIEBALDconsult4-Dec-12 3:54
mvePIEBALDconsult4-Dec-12 3:54 
Questionok Pin
Ms cindy1-Dec-12 6:18
Ms cindy1-Dec-12 6:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.