What I need to display is the customer name from the custCollection XML file and tickerSymbol, quantity, and price from the stocklist XML file. I cannot figure out what code to insert to display the correct data from each XML file. Could anyone please help.
public partial class Customer_Stock_Information_Form : Form
{
StockCollection stkCollection;
CustomerCollection custCollection;
public string custName; //field from customer class
public string tickerSymbol; //field from the stock class
public int quantity; //field from the stock class
public double currentPrice; //field from the stock
public Customer_Stock_Information_Form(StockCollection scPassed, CustomerCollection ccPassed)
{
stkCollection = scPassed;
custCollection = ccPassed;
InitializeComponent();
}
//public Customer_Stock_Information_Form(string custName, string tickerSymbol, int quantity, double currentPrice)
//{
// this.custName = custName;
// this.tickerSymbol = tickerSymbol;
// this.quantity = quantity;
// this.currentPrice = currentPrice;
//}
//when this form is loaded, add the customer ID's from each customer into the comboBox..**THIS WORKS**
private void Customer_Stock_Information_Form_Load(object sender, EventArgs e)
{
for (int i = 0; i < custCollection.Count; i++)
cboID.Items.Add(custCollection[i].Id);
}
////////once a customer ID is selected, display information for that individual in display window..**THIS IS NOT WORKING PROPERLY** **What do I need here????**
private void cboID_SelectedIndexChanged(string custName, string tickerSymbol, int quantity, double currentPrice)//(object sender, EventArgs e)
{
for (int i = 0; i < custCollection[cboID.SelectedIndex].Stocklist.Count; i++)//select customer id from cbo Box
lstCustInfo.Items.Add(custCollection[cboID.SelectedIndex].Stocklist[i]); //display the chosen customer data. THIS IS ONLY SHOWING TICKER chosen in the customer form
//lstCustInfo.Items.Add(custName, tickerSymbol, quantity, currentPrice);
//lstCustInfo.Items.Add(stkCollection(tickerSymbol, quantity,currentPrice));
}
// display customer name, ticker symbol, quantity, and price...THIS IS NOT DISPLAYING ANY DATA
public override string ToString()
{
return
"Name: " + Name + " " + "Ticker: " + tickerSymbol + " " + "Quantity: " + quantity + " " + "Price: " + currentPrice.ToString("C");
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}