Click here to Skip to main content
15,886,362 members
Home / Discussions / C#
   

C#

 
GeneralRe: Splash Screen Dispose Pin
Judah Gabriel Himango9-Mar-08 11:02
sponsorJudah Gabriel Himango9-Mar-08 11:02 
GeneralRe: Splash Screen Dispose Pin
gmhanna16-Mar-08 6:36
gmhanna16-Mar-08 6:36 
QuestionOpening files [modified] Pin
nike_arh9-Mar-08 7:12
nike_arh9-Mar-08 7:12 
GeneralRe: Opening files Pin
Giorgi Dalakishvili9-Mar-08 9:29
mentorGiorgi Dalakishvili9-Mar-08 9:29 
GeneralSome questions regarding ListView fundamental behaviour Pin
eyalbi0079-Mar-08 6:55
eyalbi0079-Mar-08 6:55 
GeneralRe: Some questions regarding ListView fundamental behaviour Pin
LongRange.Shooter10-Mar-08 9:22
LongRange.Shooter10-Mar-08 9:22 
QuestionRe: Some questions regarding ListView fundamental behaviour [modified] Pin
eyalbi00710-Mar-08 21:59
eyalbi00710-Mar-08 21:59 
GeneralRe: Some questions regarding ListView fundamental behaviour Pin
LongRange.Shooter11-Mar-08 16:32
LongRange.Shooter11-Mar-08 16:32 
WRONG.

I get only one event fired because only one event firing happens when an event gets selected. There is no such thing as an event getting fired twice because the control is 'unslecting the first item' unless you have written some code that issues the event. Regardless of how many times I did the selection, I got only one event. The only time you get multiple events fired is because you've written some bad code that is causing the multiple events to fire. Are you calling an event like Select()? Are you programattically doing something to try and change a selection? Are you bound to other events such as losing focus, our MouseLeave, or anything like that? Are you manually setting focus to something when you shouldn't?

No matter how frequently I select an item there is always only one event that is fired. That is the event model in Windows -- not something I've done. The field getting 'unselected'? That is not a seperate event unless you bind yourself to the lost focus event (or some such stupid thing as that)

In a Windows Form application the ListBox is far more flexible. You can put any object into the list. You control what is displayed by handling the ToString event. The ListView can only have ListViewItem objects in it. So from that aspect of it the ListView is pitiful.

This is the totallity of my code and I get only one event each time I select a new item no matter how many times I do it in a row. And it would be extremely amateurish of me to say I'm getting only one event if I had not done multiple selects in a row. So keep your insults to yourself.

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void listView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (listView1.SelectedIndices.Count.Equals(0)) return;

        if (listView1.SelectedItems[0].Text.Equals("Fish"))
            LoadFish();
        else
            LoadMammals();
    }

    private void LoadMammals()
    {
        listView2.Items.Clear();
        listView2.Items.Add(new ListViewItem("Horse"));
        listView2.Items.Add(new ListViewItem("Human"));
        listView2.Focus();
    }

    private void LoadFish()
    {
        listView2.Items.Clear();
        listView2.Items.Add(new ListViewItem("Mantaray"));
        listView2.Items.Add(new ListViewItem("Lion Fish"));
        listView2.Focus();
    }

}

GeneralRe: Some questions regarding ListView fundamental behaviour Pin
eyalbi00711-Mar-08 22:06
eyalbi00711-Mar-08 22:06 
QuestionDictionary Sorting ??? Pin
Jammer9-Mar-08 6:44
Jammer9-Mar-08 6:44 
AnswerRe: Dictionary Sorting ??? Pin
Professor Sharada Ulhas9-Mar-08 10:57
Professor Sharada Ulhas9-Mar-08 10:57 
GeneralRe: Dictionary Sorting ??? Pin
Jammer9-Mar-08 11:29
Jammer9-Mar-08 11:29 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 11:31
sponsorJudah Gabriel Himango10-Mar-08 11:31 
GeneralRe: Dictionary Sorting ??? Pin
Jammer9-Mar-08 12:46
Jammer9-Mar-08 12:46 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 7:17
sponsorJudah Gabriel Himango10-Mar-08 7:17 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 10:17
Jammer10-Mar-08 10:17 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 11:10
Jammer10-Mar-08 11:10 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 11:19
sponsorJudah Gabriel Himango10-Mar-08 11:19 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 11:23
Jammer10-Mar-08 11:23 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 11:33
sponsorJudah Gabriel Himango10-Mar-08 11:33 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 11:46
Jammer10-Mar-08 11:46 
GeneralOOP Question Pin
MarkPhB9-Mar-08 5:19
MarkPhB9-Mar-08 5:19 
GeneralRe: OOP Question Pin
User 66589-Mar-08 5:30
User 66589-Mar-08 5:30 
GeneralRe: OOP Question Pin
MarkPhB9-Mar-08 5:43
MarkPhB9-Mar-08 5:43 
GeneralRe: OOP Question Pin
User 66589-Mar-08 5:48
User 66589-Mar-08 5:48 

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.