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.
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 attend5days leftRegister
Soft CornerRank #1,221 · 1.5K reputationPosted May 5, 2011, 10:11 PM EDT
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());
}
krishna kumar dubey71 reputationPosted May 6, 2011, 2:41 AM EDT
when we run the program then textbox automatically fill with space.....how?
Soft CornerRank #1,221 · 1.5K reputationPosted May 6, 2011, 2:53 AM EDT
what exactly you are trying to do ?
krishna kumar dubey71 reputationPosted May 6, 2011, 4:03 AM EDT
snake vietnam16 reputationPosted May 22, 2011, 1:49 AM EDT