private void AsignarNombresDeColumnas() { if (this.listadoDataGridView.Rows.Count == 0) { this.detalleDataGridView.DataSource = null; return; } this.myDetalle = new List <DetalleGrid>(); if (this.listadoDataGridView.Rows.Count == 0) { return; } for (int i = 0; i < this.listadoDataGridView.Columns.Count; i++) { this.myDetalle.Add(DetalleGrid.Crear(this.listadoDataGridView.Columns[i].Name, string.Empty)); } this.detalleDataGridView.DataSource = myDetalle; }
private void AsignarNombresDeColumnas() { if (this.listadoDataGridView.Rows.Count.Equals(0)) { this.detalleDataGridView.DataSource = null; return; } this.myDetalle = new List <DetalleGrid>(); if (this.listadoDataGridView.Rows.Count.Equals(0)) { return; } string nombreCampo = string.Empty; for (int i = 0; i < this.listadoDataGridView.Columns.Count; i++) { nombreCampo = this.listadoDataGridView.Columns[i].Name.Replace('_', ' ').ToLower(); nombreCampo = nombreCampo.Substring(0, 1).ToUpper() + nombreCampo.Substring(1, nombreCampo.Length - 1); this.myDetalle.Add(DetalleGrid.Crear(nombreCampo, string.Empty)); } this.detalleDataGridView.DataSource = myDetalle; }