| | |
Datagridview control
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 17
Reputation:
Solved Threads: 0
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.
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.
Just get the description textbox user enters description into and pass it.
c# Syntax (Toggle Plain Text)
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"); }
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: May 2008
Posts: 17
Reputation:
Solved Threads: 0
•
•
•
•
Just get the description textbox user enters description into and pass it.
c# Syntax (Toggle Plain Text)
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"); }
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.
c# Syntax (Toggle Plain Text)
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"); } }
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Similar Threads
- Visual C#: Inserting an Access Database Record (C#)
- Passing parameter to datagridview (VB.NET)
- Why wont datagridview commit updatess? (C#)
- DataGridView populate (VB.NET)
- Datagridview problem (VB.NET)
- Passing data from datagridview to textboxes (VB.NET)
- Searching a String in DataGridView FW 2.0 (C#)
Other Threads in the C# Forum
- Previous Thread: Trying to get an RTDServer in C# working
- Next Thread: Login Pop UP
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combobox control conversion cryptographyc#winformsencryption csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ hash httpwebrequest image index input install java keypress label list listbox listener mandelbrot math mouseclick mysql netcfsvcutil.exe operator path photoshop picturebox pixelinversion pixelminversion post programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer update upload usercontrol validate validation view visualstudio webbrowser windows winforms wpf xml






