IvanSerrano Posted February 23, 2012 at 07:10 PM Report Share #440905 Posted February 23, 2012 at 07:10 PM Como e que somo varias textbox numa só, por exemplo textbox1 = "a" textbox1 = "b" textboxfinal = fica assim ( ab ) Ou seja tudo o ke escreva numa textbox soma na final ficando com um texto Cumprimentos Link to comment Share on other sites More sharing options...
Andrepereira9 Posted February 23, 2012 at 07:14 PM Report Share #440907 Posted February 23, 2012 at 07:14 PM Boas textboxfinal.Text = textBox1.Text.ToString() + textBox2.Text.ToString() + textBox3.Text.ToString(); A informática chegou para resolver problemas que antes não existiam Quem ri por último é porque está conectado a 52 Kbs. Link to comment Share on other sites More sharing options...
IvanSerrano Posted February 23, 2012 at 07:56 PM Author Report Share #440912 Posted February 23, 2012 at 07:56 PM Não é bem isso... Vou explicar melhor: void incriptacao() { string a = "&$DFD"; string b = "&%RFF"; if (textBox1.Text == "a") { textBox2.Text = a; } if (textBox1.Text == "b") { textBox2.Text = b; } Ou seja, se eu escrever na texbox 1 o seguinte texto AB nao fica assim &$DFD&%RFF Eu queria escrever o que quisesse e adicionasse o valor incriptado percebem? Por ex: string i = "&$DFD"; string v = "&$DFG"; string a = "&$DFHH"; string n = "&$DFF"; eu escrevia na textbox Ivan e ficava assim na textboxfinal &$DFD&$DFG&$DFHH&$DFF Cumprimentos Link to comment Share on other sites More sharing options...
Andrepereira9 Posted February 23, 2012 at 08:02 PM Report Share #440913 Posted February 23, 2012 at 08:02 PM if (textBox1.Text == "a") { textBox2.Text += a; } if (textBox1.Text == "b") { textBox2.Text += b; } A informática chegou para resolver problemas que antes não existiam Quem ri por último é porque está conectado a 52 Kbs. Link to comment Share on other sites More sharing options...
IvanSerrano Posted February 24, 2012 at 03:39 PM Author Report Share #441026 Posted February 24, 2012 at 03:39 PM Nao deu... Tenho a textbox A como textchange e escrevo A e na final escreve &$DFD mas para acrescentar mais texto tenho que apagar o A e escrever B, mas eu queria mesmo era escrever a palavra toda e acrescentar.. Cumprimentos Link to comment Share on other sites More sharing options...
Sponsor Posted February 27, 2012 at 11:43 AM Report Share #441303 Posted February 27, 2012 at 11:43 AM int index = 0; string a = "&$DFD"; string b = "&%RFF"; private void textBox1_TextChanged(object sender, EventArgs e) { int index1 = textBox1.Text.Length; if (index1 >= index) { string s = textBox1.Text.Substring(index, 1); if (s == "a") textBox2.Text += a; if (s == "b") textBox2.Text += b; index = index1; } } Link to comment Share on other sites More sharing options...
andrepintomp Posted February 27, 2012 at 12:15 PM Report Share #441313 Posted February 27, 2012 at 12:15 PM Boas! Acho que não precisas de tanto trabalho, pelo que percebi da tua dúvida, isto deve bastar: private void buttonjuntartexto_Click(object sender, EventArgs e) { labeltextojunto.Text = textBox1.Text + textBox2.Text; } Isto é: Ao carregar no botão, o texto que foi inserido na Textbox1.text mais o Textbox2.text vai aparecer junto labeltextojunto (é o nome que dei a label), não precisas de converter nada, pois por defeito as Textbox do C# já são do tipo string. Espero ter ajudado! 🙂 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now