Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 WinForm
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 4-Dec-12 2:31am
vinayakJJ3.4K
Comments
Krunal Rohit at 4-Dec-12 7:39am
   
Have you tried anything so far ??
hiphopper0123 at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

got the answer myself thnk you by the way
 
// 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];
                    }
            }
             
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 Jochen Arndt 180
4 DamithSL 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100