Exemple #1
0
 private void listBox1_SelectedValueChanged(object sender, EventArgs e)
 {
     if (listBox1.SelectedIndex > -1)
     {
         Prime_Broker selectedBroker = (Prime_Broker)listBox1.SelectedItem;
         Margin2      margin;
         if (myDictionary.TryGetValue(selectedBroker, out margin))
         {
             textBox1.Text = String.Format("{0}, {1}, {2}",
                                           margin.Commission,
                                           margin.Maint,
                                           margin.Fees);
         }
     }
 }
Exemple #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     for (Int32 i = 0; i < 5; i++)
     {
         Prime_Broker br = new Prime_Broker("Broker " + i.ToString(),
                                            "Symbol " + i.ToString(),
                                            "Address " + i.ToString());
         Margin2 mrg = new Margin2(i, i, i);
         myDictionary.Add(br, mrg);
         brokers.Add(br);
     }
     listBox1.DataSource    = brokers;
     listBox1.DisplayMember = "Name";
     listBox1.ValueMember   = "Name";
 }