c# - textBox items copy to different textBoxes -


I want to work in one of my projects

I want to transfer items to a text box I can get it in different text boxes.

  string [] values ​​= textbox1.Text.Split ('#'); Textbox2.Text = Value [0]; Textbox3.Text = Value [1]; TextBox4.Text = Value [2]; TextBox5.Text = Value [3]; TextBox6.Text = Value [4];   

What do I want, when 5 items will be copied into 5 different text boxes, those 5 items should be removed from the original text box.

OR

** I find 10 items in a text box named text box 1 for example: a # The following incident happens

textbox2 / b in textbox3 / c in textbox4 / d in textbox5 / e in B # C #D # E # F # G # H # IG # Textbox5 / e in textbox6

- Now when I click on button 1

I think 5 items left in text box 1 text box 3 / h Textbox 4 / G in 2g / t In text box 5 / J in text box 5 / J, the text box must be in the

>

Will start typing that tries to split your string, which limits the amount of strings returned. Removing the same method, parts are split off the input string and both arrays have to be returned with splitted strings and the remainder of the original string.

  string [] SplitWithLimit (ref string string, int range) {int count = 0; Int pos = -1; // while trying to find the position of # in the range of boundary ((pos = test.IndexOf ('#', pos + 1)) -1 = {count ++; Break (calculation == border); } String to split; If (pos! = -1) {// to split the left part of the string // to the position of four on the boundary, split = test. Substring (0, pos); Test = test.Substring (pos + 1); } Else {// If less than # less than required, then take all the strings in split = test; Test = ""; } // Now split only the required part string [] parts = toSplit.Split (new four [] {'#'}, string split option. RemoveEmptyEntries); Return parts; }   

It is now a case of handling the results of this operation which sets the original text box with the remaining array with the remaining text box

  TextBox2.Text = string.Empty; TextBox3.Text = string.Empty; TextBox4.Text = String. Empty; TextBox5.Text = string.Empty; TextBox6.Text = string.Empty; String Test = Textbox 1 Text; // "a #b # c # d # e # f # g # h # j" string [] parts = split with limit (referee test, 5); If (parts.Length & gt; 0) text box 2. Text = parts [0]; If (parts.Length & gt; 1) text box 3. Text = parts [1]; If (parts.Length & gt; 2) text box 4. Text = parts [2]; If (parts.Length & gt; 3) textbox5 Text = part [3]; If (parts.Length & gt; 4) text box 6 text = parts [4]; Text box 1 text = test;    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -