| | |
Datagridview control
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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
Views: 1759 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array bitmap box broadcast buttons c# chat check checkbox class client code color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gcd gdi+ http httpwebrequest image index install java label list listbox listener login mandelbrot math mouseclick mysql object operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update validation visualstudio webbrowser windows winforms wpf xml






