Need help with a line or two of code for listbox display

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
The section highlighted is where I need the help. I need to display the customer name from the XML customerList file and the tickerSymbol, quantity, and price from the XML stockList file.

<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas; color:blue public<span style="font-family:Consolas
<span style="color:blue partial <span style="color:blue class <span style="color:#2B91AF
Customer_Stock_Information_Form : <span style="color:#2B91AF Form
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas {
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:#2B91AF StockCollection stkCollection;
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:#2B91AF CustomerCollection custCollection;
<p style="line-height:normal; text-autospace:none
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue public <span style="color:blue string custName;
<span style="color:green //field from customer class
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue public <span style="color:blue string tickerSymbol;
<span style="color:green //field from the stock class
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue public <span style="color:blue int quantity;
<span style="color:green //field from the stock class
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue public <span style="color:blue double currentPrice;
<span style="color:green //field from the stock
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas

<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue public Customer_Stock_Information_Form(<span style="color:#2B91AF StockCollection scPassed,
<span style="color:#2B91AF CustomerCollection ccPassed)
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas {
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas stkCollection = scPassed;
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas custCollection = ccPassed;
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas InitializeComponent();
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas }
<p style="line-height:normal; text-autospace:none
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green //public Customer_Stock_Information_Form(string custName, string tickerSymbol,
int quantity, double currentPrice)
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green //{
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green // this.custName = custName;
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas <span style="color:green // this.tickerSymbol = tickerSymbol;
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green // this.quantity = quantity;
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green // this.currentPrice = currentPrice;
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green //}
<p style="line-height:normal; text-autospace:none
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas

<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green //when this form is loaded, add the customer IDs from each customer into the //comboBox..THIS WORKS
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue private <span style="color:blue void Customer_Stock_Information_Form_Load(<span style="color:blue object sender,
<span style="color:#2B91AF EventArgs e)
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas {

<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue for (<span style="color:blue int i = 0; i < custCollection.Count; i++)
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas cboID.Items.Add(custCollection.Id);

<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas }
<p style="line-height:normal; text-autospace:none
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green; background:aqua ////////<span style="color:green once a customer ID is selected, display information for that individual in display window..<span style="background:aqua THIS IS NOT WORKING PROPERLY
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue private <span style="color:blue void cboID_SelectedIndexChanged(<span style="color:green object sender, EventArgs e)

<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas {
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue for (<span style="color:blue int i = 0; i < custCollection[cboID.SelectedIndex].Stocklist.Count; i++)<span style="color:green //select customer id from cbo Box
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas lstCustInfo.Items.Add(custCollection[cboID.SelectedIndex].Stocklist);
<span style="color:green //display the chosen customer data. THIS IS ONLY SHOWING TICKER chosen in the customer form, I need the name to display.
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green //lstCustInfo.Items.Add(custName, tickerSymbol, quantity, currentPrice);
<span style="color:green //lstCustInfo.Items.Add(stkCollection(tickerSymbol,quantity,currentPrice));

<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="background:aqua }
<p style="line-height:normal; text-autospace:none
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas

<p style="line-height:normal; text-autospace:none
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:green // display customer name, ticker symbol, quantity, and price... // THIS IS NOT DISPLAYING the CORRECT DATA
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue public <span style="color:blue override <span style="color:blue
string ToString()
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas {
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue return
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas <span style="color:#A31515 "Name: " + Name +
<span style="color:#A31515 " " + <span style="color:#A31515 "Ticker: " + tickerSymbol +
<span style="color:#A31515 " " + <span style="color:#A31515
"Quantity: " + quantity +
<span style="color:#A31515 " " + <span style="color:#A31515 "Price: " + currentPrice.ToString(<span style="color:#A31515 "C");
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas }
<p style="line-height:normal; text-autospace:none
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue private <span style="color:blue void btnExit_Click(<span style="color:blue object sender,
<span style="color:#2B91AF EventArgs e)
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas {
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas
<span style="color:blue this.Close();
<p style="line-height:normal; text-autospace:none <span style="font-family:Consolas }

View the full article
 
Back
Top