private void TxtBuscar_TextChanged(object sender, EventArgs e) { String cad1; errorProvider1.Clear(); try { foreach (DataGridViewRow fila in DgvDatos.Rows) { TxtBuscar.Text = TxtBuscar.Text.ToUpper(); cad1 = fila.Cells[1].Value.ToString(); if (cad1.StartsWith(TxtBuscar.Text) == true) { fila.Selected = true; break; } } TxtBuscar.SelectionStart = TxtBuscar.Text.Length; } catch { errorProvider1.SetError(TxtBuscar, "No existe el Nombre...!!"); TxtBuscar.Focus(); } }
private void BtnBuscar_Click(object sender, EventArgs e) { if (TxtBuscar.Text.Trim() != "") { BuscarCliente(TxtBuscar.Text); } else { MessageBox.Show("Ingese texto a buscar", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } TxtBuscar.Focus(); TxtBuscar.SelectAll(); }
/// <summary> /// Refresta grid /// </summary> private void RefrescarTabla() { try { metroGrid1.DataSource = bll.List(); metroGrid1.Columns[0].Visible = false; metroGrid1.Columns[1].Width = 220; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } metroGrid1.ClearSelection(); TxtBuscar.Focus(); }
private void RefrescarTabla() { try { metroGrid1.DataSource = BLL.UFP.Usuario.GetAllAdapted(); CaracteristicasGrid(); } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } metroGrid1.ClearSelection(); TxtBuscar.Focus(); }
private void FrmShowIt_Load(object sender, EventArgs e) { this.Text = PerfilShow.Titulo; GvGeneral.Columns.Clear(); GvGeneral.OptionsBehavior.AutoPopulateColumns = false; GvGeneral.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.False; GvGeneral.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False; GvGeneral.OptionsBehavior.Editable = false; GvGeneral.OptionsFilter.AllowFilterEditor = false; GvGeneral.OptionsFilter.AllowColumnMRUFilterList = false; GvGeneral.OptionsFilter.AllowMRUFilterList = false; GvGeneral.OptionsFilter.MRUFilterListPopupCount = 0; GvGeneral.OptionsFilter.MRUFilterListCount = 0; GvGeneral.OptionsFilter.MRUColumnFilterListCount = 0; GvGeneral.OptionsCustomization.AllowGroup = false; GvGeneral.OptionsCustomization.AllowQuickHideColumns = false; GvGeneral.OptionsCustomization.AllowFilter = false; GvGeneral.OptionsView.EnableAppearanceOddRow = true; GvGeneral.OptionsView.ShowGroupPanel = false; GvGeneral.OptionsHint.ShowColumnHeaderHints = false; GvGeneral.OptionsView.ShowIndicator = true; GvGeneral.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.Default; GvGeneral.OptionsMenu.EnableColumnMenu = false; GvGeneral.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; GvGeneral.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; switch (Ordenar) { case OrdenarPor.CampoNombre: campoOrden = PerfilShow.Tabla + "." + PerfilShow.CampoNombre; break; case OrdenarPor.CampoCodigo: campoOrden = PerfilShow.Tabla + "." + PerfilShow.CampoCodigo; break; case OrdenarPor.CampoId: campoOrden = PerfilShow.Tabla + "." + PerfilShow.Llave; break; default: campoOrden = PerfilShow.Tabla + "." + PerfilShow.CampoNombre; break; } if (!String.IsNullOrEmpty(Filtro)) { LlenarDataSet(); LlenarGrilla(); SendKeys.Send("{tab}"); SendKeys.Send("{tab}"); } if (GvGeneral.RowCount == 0) { TxtBuscar.Focus(); } ConsultarPermisos(); }