hi, i have a textbox and i want to fill the textbox with the spaces. and count the spaces.
....and how to set the maximum line in textbox?
Loading
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.
snake vietnamPosted May 22, 2011, 5:49 AM
krishna kumar dubeyPosted May 6, 2011, 8:03 AM
Soft CornerPosted May 6, 2011, 6:53 AM
what exactly you are trying to do ?
krishna kumar dubeyPosted May 6, 2011, 6:41 AM
when we run the program then textbox automatically fill with space.....how?
Soft CornerPosted May 6, 2011, 2:11 AM
you can fill textbox with spaces with text property & for setting up maximum line MaxLines property.
here is the code how can you done this all :
Xaml :
Name="textbox1" TextAlignment="Center"
TextWrapping="Wrap"
MaxLength="500"
MinLines="1"
MaxLines="15" Margin="131,49,278,265" />
.cs code :
private void btn_countChar_Click(object sender, RoutedEventArgs e)
{
int count=0;
foreach (char c in textbox1.Text)
{
if (char.IsWhiteSpace(c))
{
count++;
}
}
MessageBox.Show("Spaces in TextBox: " + count.ToString());
}