Datagridview control

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 17
Reputation: sireesha.c is an unknown quantity at this point 
Solved Threads: 0
sireesha.c sireesha.c is offline Offline
Newbie Poster

Datagridview control

 
0
  #1
Jun 9th, 2008
Hi,
In my Datagridview contains itemno,itemdescription,quantity,price columns.
this values can view in crystal report.in crystal report only 10 colums can able to view.
so,in item descriptionin cell only 10 lines i have to enter .if it is more than that i want to display messagebox and chance is there for only one item description contails more than 10 lines.In this situation also i want to display error message.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Datagridview control

 
0
  #2
Jun 9th, 2008
Just get the description textbox user enters description into and pass it.
  1. int HowManyOccurance(string str, char charToSearchFor)
  2. {
  3. int numberOfOccurance = 0;
  4. CharEnumerator ce = str.GetEnumerator();
  5. while(ce.MoveNext())
  6. {
  7. if (ce.Current == charToSearchFor)
  8. numberOfOccurance++;
  9. }
  10. return numberOfOccurance;
  11. }
  12.  
  13. {
  14. if(HowManyOccurance(yourTextBox.Text, '\n') <=10)
  15. MessageBox.Show("Correct");
  16. else
  17. MessageBox.Show("Please make it shorter, just 10 lines permitted");
  18. }
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 17
Reputation: sireesha.c is an unknown quantity at this point 
Solved Threads: 0
sireesha.c sireesha.c is offline Offline
Newbie Poster

Re: Datagridview control

 
0
  #3
Jun 10th, 2008
Originally Posted by RamyMahrous View Post
Just get the description textbox user enters description into and pass it.
  1. int HowManyOccurance(string str, char charToSearchFor)
  2. {
  3. int numberOfOccurance = 0;
  4. CharEnumerator ce = str.GetEnumerator();
  5. while(ce.MoveNext())
  6. {
  7. if (ce.Current == charToSearchFor)
  8. numberOfOccurance++;
  9. }
  10. return numberOfOccurance;
  11. }
  12.  
  13. {
  14. if(HowManyOccurance(yourTextBox.Text, '\n') <=10)
  15. MessageBox.Show("Correct");
  16. else
  17. MessageBox.Show("Please make it shorter, just 10 lines permitted");
  18. }



private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
TextBox txt=e.Control as TextBox;
txt.TextChanged +=new EventHandler(txt_TextChanged);
}

void txt_TextChanged(object sender, EventArgs e)
{

}


in text changed event i have to find number of lines and number of character i entered.
plz help me.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Datagridview control

 
0
  #4
Jun 11th, 2008
  1. void txt_TextChanged(object sender, EventArgs e)
  2. {
  3. 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)
  4. {
  5. int numberOfOccurance = 0;
  6. CharEnumerator ce = str.GetEnumerator();
  7. while(ce.MoveNext())
  8. {
  9. if (ce.Current == charToSearchFor)
  10. numberOfOccurance++;
  11. }
  12. return numberOfOccurance;
  13. }
  14.  
  15. {
  16. if(HowManyOccurance(yourTextBox.Text, '\n') <=10)
  17. MessageBox.Show("Correct");
  18. else
  19. MessageBox.Show("Please make it shorter, just 10 lines permitted");
  20. }
  21. }
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC