ListBox onchange event ?

  • Thread starter Thread starter Jacques Oberto
  • Start date Start date
J

Jacques Oberto

HI All,

I would like my app to be notified when there is a change in
ListBox.items.count. I didn't find the corresponding event in
csharp and I know Delphi has it ;)
Thanks for your help,

Jacques
 
I would like my app to be notified when there is a change in
ListBox.items.count. I didn't find the corresponding event in
csharp and I know Delphi has it ;)

Nothing can get into the list box without your code putting it there, so
write a wrapper for this kind of access and raise an event when an item is
added or removed.
 
"Mark Rae [MVP]" a écrit
How are you populating the ListBox...?


Hi Mark,

The ListBox is populated when the form is created and also
in response to the clicking of 4 different buttons (add, remove
add all, remove all). I know I can copy-paste 5 times the same
"item-checking" lines of code to each of these events but it
would insult my taste for elegance :)

Jacques
 
"Mark Rae [MVP]" a écrit
Irrelevant...


Let me disagree with you on this one. Isn't Anders Hejlsberg the smart guy
at the origin of both languages ?

Jacques
 
"Mark Rae [MVP]" a écrit
Obviously, in view of your taste for elegance [of code], you must surely
have wired these four buttons up to the same Click event which the
Form_Load event also calls...

I used the "Shown" event of the form (which does not require clicking to
populate the listbox at startup.

Jacques
 
Mark Rae said:
Again, completely irrelevant... Do you honestly believe that C# *must*
therefore include every feature of Delphi, and vice versa...?

Not all but only the useful ones !

Jacques
 
Back
Top