public int CompareTo(object o) { VBDRow r = (VBDRow)o; string c1 = this.VBD.userdevice; string c2 = r.VBD.userdevice; int i1; int i2; if (int.TryParse(c1, out i1) && int.TryParse(c2, out i2)) { return(i1 - i2); } else { return(c1.CompareTo(c2)); } }
private void UpdateData() { try { dataGridViewStorage.SuspendLayout(); foreach (DataGridViewRow r in dataGridViewStorage.Rows) { VBDRow row = r as VBDRow; row.UpdateCells(); } dataGridViewStorage.Sort(dataGridViewStorage.SortedColumn, dataGridViewStorage.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); } catch (Exception e) { log.Error("Error updating vm storage list.", e); } finally { dataGridViewStorage.ResumeLayout(); } }