Tim

Tim

  • NA
  • 1
  • 0

ListBox Help

Nov 14 2007 10:26 PM

Hi people, first post here =]

I have a C#.Net program that has 3 forms ( frmMain, frmPrint, frmAudio.)  Each of the three forms have a listbox, frmPrint and frmAudio have values in the listbox which the user can select and then the listbox control on frmMain gets updated with whatever values they select.

I need to do some calcuations on the values that are entered on frmMain listbox.  The problem is I can't seem to find the right event so I can calculate these values on the fly whenever the listbox has a item added or removed. 

foreach (object o in lstProducts.Items)

{

if (o.ToString() == "I Did It Your Way (Print)")

txtShipping.Text = "works";

}

 

I've tried the SelectedIndexChanged and SelectedValueChange and the form_Load and form_enter events with the above code, none work.  the selectedIndexChange requires me to click an item in the listbox.  This is not what I want.

I want it to automatically and on the fly do the calcuations (or in the above code, display the text in the textbox.) 

Am I clear here?  Advice/suggestions please.


Answers (2)