Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a file which have content like this
a ,b,
c ,d,
e ,f,
g ,h,

now i have added a c e and g to the combobox after reading file by streamreader and then split the string. Now when i select a in combobox corresponding b value should be displayed on textbox likewise if i click on g h shuld be displayed on textbox.
Posted
Comments
[no name] 4-Dec-12 7:39am    
Have you tried anything so far ??
vinayakJJ 4-Dec-12 7:43am    
yes but i am getting output b if i select a
but i select c e or h it didnt display output
my coding is
if (i == ind)
{
textBox1.Text = split[i + 1];
}
where ind is index position of selected item and i am adding index by i in split array so i get b but for other index position get changed

1 solution

got the answer myself thnk you by the way

C#
// MessageBox.Show(i.ToString());
            int count = 0;
            int splitcount = split.Length / 2;
            for (int i = 0; i < split.Length; i++)
            {
                count++;
             
                    if (i == ind)
                    {
                        textBox1.Text = split[i + 1*count];
                    }
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900