 <p>Create a <code>List&lt;TextBox&gt;</code> for each group:</p> <pre><code> List&lt;TextBox&gt; list01 = new List&lt;TextBox&gt;() { tbPlay0, tbPlay1, ....}; List&lt;TextBox&gt; list02 = new List&lt;TextBox&gt;() { ..., ... , ....}; // .. } </code></pre> <p>And pass such a group to the function:</p> <pre><code>private void convertBasetoDrawn(List&lt;TextBox&gt; list, string numBase, string reference) { string[] texts = new string[8] { "000", "500", "050", "005", "550", "505", "055", "555" }; for (int t = 0; t &lt; list.Count; t++) list[t].Text = texts[t]; list[0].ForeColor = Color.Red; list[7].ForeColor = Color.Red; } </code></pre> <p>Assuming the texts will always look like that. If they depend on, maybe <code>numbase</code> you can construct them dynamically as well, as long as you know the rules.. Maybe even a simple replacement will do the job?</p> <p>You didn't use <code>reference</code>, btw..</p> <p>Now, I'm just guessig here, but maybe this is the pattern for your texts..:</p> <pre><code> string[] texts = new string[8] { "nnn", "dnn", "ndn", "nnd", "ddn", "dnd", "ndd", "ddd" }; for (int s = 0; s &lt; texts.Length; s++) texts[s] = texts[s].Replace("d", numBase).Replace("n", reference); </code></pre> <p>Now you can call it like this:</p> <pre><code>convertBasetoDrawn(list01, "0","5"); </code></pre> <p>Update: For the rules as I understand them now you could do:</p> <pre><code>string newText = ""; for (int s = 0; s &lt; texts.Length; s++) { newText = ""; for (int i = 0; i &lt; 3; i++) { if (texts[s][i] == 'n') newText += numBase[i]; else newText += (Convert.ToByte(numBase[i].ToString()) + Convert.ToByte(reference[0].ToString()) ).ToString("0"); } texts[s] = newText; } </code></pre> <p>and call it like this: </p> <pre><code> convertBasetoDrawn(list01, "001", "5"); </code></pre> <p>or</p> <pre><code> convertBasetoDrawn(list02, "000", "1"); </code></pre> <p>Note: no carry over here.. You'd have to define rules for that and code it yourself..</p>