hi,
I want to get the value stored at integer array displayed on the textbox on selecting the itembox item i.e. the position of integer array element changes with change in itembox item index.
How to do this ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Datta KharadPosted Nov 19, 2011, 2:23 AM
You can use this code for your above problem..
int[] arrPriceList; //Declare array
private void Form1_Load(object sender, EventArgs e)
{
//Initialize array with given value
arrPriceList = new int[] { 25000, 85000, 65000, 40000, 70000 };
//Add cars into listbox
listBox1.Items.AddRange(new object[] { "MARUTI", "INDICA", "SCODA", "SHIFT", "CIVIC" });
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
textBox3.Text = (arrPriceList[listBox1.SelectedIndex]).ToString();
}
//You will get price according to selected car.
Datta KharadPosted Nov 23, 2011, 1:33 AM
If your query resolved then mark as Correct Answer.
Manoj Singh PanwarPosted Nov 21, 2011, 1:28 PM
Manoj Singh PanwarPosted Nov 19, 2011, 1:16 AM
Now how to bind these two things?
Javeed M ShaikhPosted Nov 16, 2011, 10:24 PM
I am not clear of the requirements can you please explain with an example.