How can I determine if a string is a valid date
You can use the static DateTime.Parse or DateTime.ParseExact and catch any exceptions. System.DateTime myDateTime; bool isValid = true; try { myDateTime = System.DateTime.Parse(strMyDateTime); } catch (Exception e) { isValid = false; }
How do I use VS to add an override for a virtual member of a baseclass
In the ClassView window, expand the base class under your derived class. Then right-click the desired method, and select Add.
How can I reset the OnMouseHover timer so that it will fire again without the mouse having to leave the client area of a control
In the microsoft.public.dotnet.framework.windowsforms newsgroup, T. H. in den Bosch posted the following suggestion with a potential warning: I found out that calling Control.ResetMouseEventArgs() does the trick. This is an undocumented internal method, so I don’t know if calling it has adverse side effects.
Is there a .Net way of deciding whether a string is numeric or not
VB.NET has a IsNumeric method that you can use to recognize a Short, Integer, Long, Decimal or Single numeric type. From C#, you can use try/catch to look for a particular numeric type. //long for a Single Single num; try { num = Single.Parse(someString); } catch (Exception e) { // if this is hit, someString is not a Single }
How can I catch a double-click into a column header cell
You can use the DataGrid’s double-click event and its HitTest method to catch a double click on a header. private void dataGrid1_DoubleClick(object sender, System.EventArgs e) { System.Drawing.Point pt = dataGrid1.PointToClient(Cursor.Position); DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt); if(hti.Type == DataGrid.HitTestType.ColumnHeader) { MessageBox.Show(‘double clicked clicked column header ‘ + hti.Column.ToString()); } }