|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
cell in DataGridView BindingNavigator to format dateInput is entered into DataGridView but if a user enters 01/01/0200 the database rejects the date. So I used the following code in the BindingNavigatorSaveItem_Click routine: DataGridViewRow dateagc = tblInvDistYearAbsDataGridView.CurrentRow; //Dateagc = dateagc.Cells[1].Value.ToString(); Dateagc = Convert.ToDateTime(dateagc.Cells[1].Value.GetType()); DateAgc = Convert.ToDateTime(Dateagc); //if ((Convert.ToDateTime("Date Agency") < Convert.ToDateTime("1/1/1753")) | (Convert.ToDateTime("Date Agency") > Convert.ToDateTime("12/31/999"))) if ((DateAgc < Convert.ToDateTime("1/1/1753")) | (DateAgc > Convert.ToDateTime("12/31/999"))) { MessageBox.Show("Please enter a valid date"); return; } The problem is says it can't convert System.DateTime to string. What is the right syntax to convert the cell value to property DateTime Format? -- JB
Problem creating TemplateFields in DetailsView dynamically
{0:c} causes input string not in correct format exception Rendering a GridView 2nd Post - {0:c} causes deletes to fail! Updating SelectedIndex after delete programmatically create a gridview In a GridView i have a new dataset i want to show in it... Controling grdiview width in the update mode ... persistent objectdatasource Gridview - spaced between columns but not between rows. |
|||||||||||||||||||||||