Name : textbox
Mobile No : textbox
Then when click on show button then show the string in following format
Ex: Name= ABCD and Mobile no = 9090969698
Result should be like = A9B0C9D0969698
Thanks & Regards
Farukh
Mobile No : textbox
Then when click on show button then show the string in following format
Ex: Name= ABCD and Mobile no = 9090969698
Result should be like = A9B0C9D0969698
Thanks & Regards
Farukh
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Priya LingePosted Aug 23, 2011, 2:09 AM
Please try this,
private void button1_Click(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
string firststring;
string secondstring;
firststring = txtfirst.Text;
secondstring = txtsecond.Text;
if (firststring.Length > secondstring.Length)
{
int count = 1;
foreach (char ch in firststring)
{
int i = 1;
foreach (char chh in secondstring)
{
if (i == count)
{
sb.Append(ch).Append(chh);
}
i++;
}
if (count > secondstring.Length)
{
sb.Append(ch);
}
count++;
}
MessageBox.Show(sb.ToString());
}
else
{
int count = 1;
foreach (char ch in secondstring)
{
int i = 1;
foreach (char chh in firststring)
{
if (i == count)
{
sb.Append(chh).Append(ch);
}
i++;
}
if (count > firststring.Length)
{
sb.Append(ch);
}
count++;
}
MessageBox.Show(sb.ToString());
}
}
OutPut :
firststring : ABCD
secondstring : 9090969698
O/P :A9B0C9D0969698
Thanks.
Jaganathan BantheswaranPosted Aug 23, 2011, 8:25 AM
VulpesPosted Aug 23, 2011, 5:30 AM
Priya LingePosted Aug 23, 2011, 2:59 AM
Your welcome.
Thanks
Farukh MujawarPosted Aug 23, 2011, 2:44 AM
Thanks a lot it works!!!
Farukh MujawarPosted Aug 23, 2011, 2:06 AM
my output like A9B0C9D0969698.
Jiteendra SampathiraoPosted Aug 23, 2011, 1:20 AM
protected void btn_click(object sender, EventArgs e)
{
string xyz = TextBox1.Text + TextBox2.Text;
}
hope it help you......