Just get the description textbox user enters description into and pass it.
int HowManyOccurance(string str, char charToSearchFor)
{
int numberOfOccurance = 0;
CharEnumerator ce = str.GetEnumerator();
while(ce.MoveNext())
{
if (ce.Current == charToSearchFor)
numberOfOccurance++;
}
return numberOfOccurance;
}
{
if(HowManyOccurance(yourTextBox.Text, '\n') <=10)
MessageBox.Show("Correct");
else
MessageBox.Show("Please make it shorter, just 10 lines permitted");
}
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
void txt_TextChanged(object sender, EventArgs e)
{
if(HowManyOccurance(yourTextBox.Text, '\n') <=10)MessageBox.Show("Correct");elseMessageBox.Show("Please make it shorter, just 10 lines permitted");}int HowManyOccurance(string str, char charToSearchFor)
{
int numberOfOccurance = 0;
CharEnumerator ce = str.GetEnumerator();
while(ce.MoveNext())
{
if (ce.Current == charToSearchFor)
numberOfOccurance++;
}
return numberOfOccurance;
}
{
if(HowManyOccurance(yourTextBox.Text, '\n') <=10)
MessageBox.Show("Correct");
else
MessageBox.Show("Please make it shorter, just 10 lines permitted");
}
}
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276