When i enter 12 in textbox it should convert into 0101010112
randomaly when i enter 134 it should convert into 0101010134
in windows form
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.
VulpesPosted Apr 10, 2014, 7:19 AM
Anyway, glad it's working now :)
Angel PrincessPosted Apr 10, 2014, 7:09 AM
the error was
Angel PrincessPosted Apr 10, 2014, 7:09 AM
Jignesh TrivediPosted Apr 10, 2014, 6:44 AM
I have test vulpes code it working fine for me....
What error are you getting? can you please share error text?
Angel PrincessPosted Apr 10, 2014, 6:39 AM
VulpesPosted Apr 10, 2014, 6:04 AM
int len = textBox1.Text.Length;
if (len < 10)
{
string padding = "0101010101";
textBox1.Text = padding.Substring(0, 10 - len) + textBox1.Text;
}
Jignesh TrivediPosted Apr 10, 2014, 4:30 AM
Is it true what ever Munesh says?
so can you please provide more information? what is logic etc...
Angel PrincessPosted Apr 10, 2014, 4:26 AM
Munesh SharmaPosted Apr 10, 2014, 1:50 AM
Jignesh TrivediPosted Apr 10, 2014, 12:57 AM
hi,
I think 01010101 is prefix right?
so in this case you can write textbox lost focus event and in this event you can add this prefix
textbox1.Text = "01010101" + textbox1.Text;
hope this will help you.