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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Priya LingeRank #785 · 2.9K reputationPosted Aug 22, 2011, 10:09 PM EDT
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.
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Aug 22, 2011, 9:20 PM EDT
protected void btn_click(object sender, EventArgs e)
{
string xyz = TextBox1.Text + TextBox2.Text;
}
hope it help you......
Farukh Mujawar106 reputationPosted Aug 22, 2011, 10:06 PM EDT
my output like A9B0C9D0969698.
Farukh Mujawar106 reputationPosted Aug 22, 2011, 10:44 PM EDT
Thanks a lot it works!!!
Priya LingeRank #785 · 2.9K reputationPosted Aug 22, 2011, 10:59 PM EDT
Your welcome.
Thanks
VulpesRank #55 · 29.2K reputationPosted Aug 23, 2011, 1:30 AM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Aug 23, 2011, 4:25 AM EDT