Input a string in a textbox and reverse the string to display it in another textbox

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I want to input a string in a textbox and reverse the string to display it in another textbox by the click of a button.
BELOW IS THE CODE
using System;<br/>
using System.Collections.Generic;<br/>
using System.ComponentModel;<br/>
using System.Data;<br/>
using System.Drawing;<br/>
using System.Text;<br/>
using System.Windows.Forms;<br/>
<br/>
namespace Reverse_a_string<br/>
{<br/>
public partial class Form1 : Form<br/>
{<br/>
public Form1()<br/>
{<br/>
InitializeComponent();<br/>
}<br/>
<br/>
private void button1_Click(object sender, EventArgs e)<br/>
{<br/>
string str;<br/>
str = textBox1.Text;<br/>
char [] arr = str.ToCharArray();<br/>
Array.Reverse(arr);<br/>
string str2 = Convert.ToString(arr);<br/>
textBox2.Text = str2;<br/>
}<br/>
}<br/>
}

It doesnt give any error but displays output as System.Char[] .
Output should be the reversed string in the textbox2.
<span style="text-decoration:underline Please Help

View the full article
 
Back
Top