private void altaV_Load(object sender, EventArgs e) { if (appPath == "Local") appPath = AppDomain.CurrentDomain.BaseDirectory; // dgEmpleados.Rows.Add(); MaskedTextBoxColumn maskColumn; DataGridViewTextBoxColumn dgvtbc; maskColumn = new MaskedTextBoxColumn(); maskColumn.Name = "empezo"; maskColumn.HeaderText = "Empezo"; maskColumn.Mask = "00:00"; maskColumn.Width = 50; this.dgVoucher.Columns.Add(maskColumn); maskColumn = new MaskedTextBoxColumn(); maskColumn.Name = "termino"; maskColumn.HeaderText = "Termino"; maskColumn.Mask = "00:00"; maskColumn.Width = 50; this.dgVoucher.Columns.Add(maskColumn); dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Codigo de OperaciĆ³n"; dgvtbc.Name = "codOp"; dgvtbc.MaxInputLength = 8; dgvtbc.Width = 130; this.dgVoucher.Columns.Add(dgvtbc); maskColumn = new MaskedTextBoxColumn(); maskColumn.HeaderText = "Prod Total"; maskColumn.Mask = "00000"; maskColumn.Width = 70; this.dgVoucher.Columns.Add(maskColumn); dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Horas"; dgvtbc.Width = 50; dgvtbc.ReadOnly = true; this.dgVoucher.Columns.Add(dgvtbc); dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Pzas/Hra"; dgvtbc.Width = 60; dgvtbc.ReadOnly = true; this.dgVoucher.Columns.Add(dgvtbc); dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Eficiencia"; dgvtbc.Width = 60; dgvtbc.ReadOnly = true; this.dgVoucher.Columns.Add(dgvtbc); //dgVoucher.Rows.Add(); }
// Creates and Initializes the columns for our DataGridView. private void InitializeDataGridViewColumns() { DataGridViewTextBoxColumn dgvtbc; MaskedTextBoxColumn mtbc; // // employee name. // dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Name"; dgvtbc.Width = 120; this.employeesDataGridView.Columns.Add(dgvtbc); // // Employee ID -- this will be of the format: // [A-Z][0-9][0-9][0-9][0-9][0-9] // // this is well sutied to using a MaskedTextBox column. // mtbc = new MaskedTextBoxColumn(); mtbc.HeaderText = "Employee ID"; mtbc.Mask = "L00000"; mtbc.Width = 75; this.employeesDataGridView.Columns.Add(mtbc); // // [American] Social Security number, of the format: // ###-##-#### // mtbc = new MaskedTextBoxColumn(); mtbc.HeaderText = "SSN"; mtbc.Mask = "000-00-0000"; mtbc.Width = 75; this.employeesDataGridView.Columns.Add(mtbc); // // Address // dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Address"; dgvtbc.Width = 150; this.employeesDataGridView.Columns.Add(dgvtbc); // // City // dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "City"; dgvtbc.Width = 75; this.employeesDataGridView.Columns.Add(dgvtbc); // // State // mtbc = new MaskedTextBoxColumn(); mtbc.HeaderText = "State"; mtbc.Mask = "LL"; mtbc.Width = 40; this.employeesDataGridView.Columns.Add(mtbc); // // Zip Code #####-#### (+4 optional) // mtbc = new MaskedTextBoxColumn(); mtbc.HeaderText = "Zip Code"; mtbc.Mask = "00000-0000"; mtbc.Width = 75; mtbc.ValidatingType = typeof(ZipCode); this.employeesDataGridView.Columns.Add(mtbc); // // Department Code // dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Department"; dgvtbc.ValueType = typeof(int); dgvtbc.Width = 75; this.employeesDataGridView.Columns.Add(dgvtbc); }
private void CreateColumns() { // Create Columns DataGridViewTextBoxColumn dgvtbc; MaskedTextBoxColumn mtbc; // Add Replenishment Date Column mtbc = new MaskedTextBoxColumn(); mtbc.HeaderText = "Replenishment Date"; mtbc.DataPropertyName = "Replenishment Date"; mtbc.Mask = "00/00/0000"; mtbc.Width = 200; mtbc.ValueType = typeof(String); mtbc.DefaultCellStyle.SelectionForeColor = Color.Black; mtbc.DefaultCellStyle.SelectionBackColor = Color.Yellow; mtbc.ReadOnly = false; dgDates.Columns.Add(mtbc); // Add Compliance Date Column mtbc = new MaskedTextBoxColumn(); mtbc.HeaderText = "Compliance Date"; mtbc.DataPropertyName = "Compliance Date"; mtbc.Mask = "00/00/0000"; mtbc.Width = 200; mtbc.ValueType = typeof(String); mtbc.IncludeLiterals = false; mtbc.DefaultCellStyle.SelectionForeColor = Color.Black; mtbc.DefaultCellStyle.SelectionBackColor = Color.Yellow; dgDates.Columns.Add(mtbc); dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "Delqt"; dgvtbc.DataPropertyName = "Delqt"; dgvtbc.Width = 100; dgvtbc.ValueType = typeof(string); dgvtbc.DefaultCellStyle.SelectionForeColor = Color.Black; dgvtbc.DefaultCellStyle.SelectionBackColor = Color.Yellow; dgvtbc.ReadOnly = true; dgDates.Columns.Add(dgvtbc); dgvtbc = new DataGridViewTextBoxColumn(); dgvtbc.HeaderText = "ID"; dgvtbc.DataPropertyName = "ID"; dgvtbc.Width = 100; dgvtbc.DefaultCellStyle.SelectionForeColor = Color.Black; dgvtbc.DefaultCellStyle.SelectionBackColor = Color.Yellow; dgvtbc.ReadOnly = true; dgvtbc.Visible = false; dgDates.Columns.Add(dgvtbc); }