Use variable as part of textbox name in C# -


i developing program wth 30 text boxes , 30 check boxes next them. want people check names , press send button. program saves names in txt file true or false statement next them, uploads file ftp server me analize. problem facing don't want write code every text , check box load , save it's value on txt file. if name text boxes tbox1;tbox2;tbox3 etc. how use loop write value of tbox i + ; + cbox i on line i of thing.txt or vice versa? please grately apreciated because save me lot of unnesacery code writing!

        (int = 0; <= count; i++)         {             textbox textbox = (textbox)controls.find(string.format("tbox{0}", i),false).firstordefault();             checkbox checkbox = (checkbox)controls.find(string.format("cbox{0}", i),false).firstordefault();              string s = textbox.text + (checkbox.checked ? "true" : "false");         } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -