public frmMain() { InitializeComponent(); LoadConfig(); nudPort.Value = (Decimal)httpPort; edHost.Text = tvServerHost; nudWidth.Value = thumbWidth; nudHeight.Value = thumbHeight; edPlayer.Text = clientPlayer; edUid.Text = uid; edPwd.Text = pwd; cbPlayerType.SelectedIndex = playerType; foreach (EncoderConfig cfg in encCfgs) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(grid); row.Cells[0].Value = cfg.displayName; row.Cells[1].Value = cfg.useTranscoding; row.Cells[2].Value = cfg.fileName; row.Cells[3].Value = cfg.args; row.Cells[4].Value = cfg.inputMethod.ToString(); row.Cells[5].Value = cfg.outputMethod.ToString(); grid.Rows.Add(row); } grid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); }
private void FilterPropertiesDlg_Load(object sender, EventArgs e) { // заполняем таблицу foreach (var item in filter.ColumnFilters.Values.ToList()) { var row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell { Value = item.PropInfo.Name }); row.Cells.Add(new DataGridViewTextBoxCell { Value = item.Title }); if (item.EnabledValues.Length > 0) { var valueCol = new DataGridViewComboBoxCell(); valueCol.Items.AddRange(item.EnabledValues.ToArray()); row.Cells.Add(valueCol); } else row.Cells.Add(new DataGridViewTextBoxCell {Value = item.Value ?? string.Empty}); var criteriasCol = new DataGridViewComboBoxCell(); criteriasCol.Items.AddRange(item.GetStringCriterias()); if (item.Criterias != ColumnFilterCriteria.Нет) criteriasCol.Value = item.Criterias.ToString(); else criteriasCol.Value = criteriasCol.Items[0]; row.Cells.Add(criteriasCol); grid.Rows.Add(row); } }
/// <summary> /// Recursively goes through all files in the directory /// and adds them to the MyFilesDB /// </summary> /// <param name="directory">Current Directory To Search</param> private void addDirectory(String directory) { try { foreach (String file in Directory.GetFiles(directory)) { myFilesDb.AddFile(file); DataGridViewRow row = new DataGridViewRow(); DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell(); cell.Value = "Hashed: " + file; row.Cells.Add(cell); if (isShown && !gvLog.IsDisposed && !this.IsDisposed) { try { this.Invoke(new MethodInvoker( delegate() { gvLog.Rows.Insert(0, row); })); } catch { isShown = false; } } } } catch { } foreach (String nextDir in Directory.GetDirectories(directory)) { addDirectory(nextDir); } }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { Role info = item as Role; row.Tag = item; row.Cells["colName"].Value = info.Name; row.Cells["colMemo"].Value = info.Memo; }
private void FormSenka_Load(object _sender, EventArgs _e) { RecordManager.Instance.Senka.OnUpdated += UpdatedRanking; APIObserver.Instance.APIList["api_port/port"].ResponseReceived += (_, __) => { UpdatedMySenka(); UpdatedRanking(); }; // フォント設定変更時反映イベント Utility.Configuration.Instance.ConfigurationChanged += ConfigurationChanged; // 各順位の行を作成 SenkaView.SuspendLayout(); SenkaView.Rows.Clear(); int[] ranks = { 1, 5, 20, 100, 500 }; for(int i = 0; i < RankRows.Length; i++) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(SenkaView); row.Cells[SenkaView_Rank.Index].Value = $"{ranks[i]}位"; SenkaView.Rows.Add(row); RankRows[i] = row; } ConfigurationChanged(); SenkaView.ResumeLayout(); }
private void AddARow(int i) { DataGridViewRow Arow = new DataGridViewRow(); Arow.HeaderCell.Value = i.ToString(); Arow.Height = dataGridView1.Height / k; dataGridView1.Rows.Add(Arow); }
private static Replacement RowToReplacement(DataGridViewRow dataGridRow) { Replacement rep = new Replacement { Enabled = ((bool)dataGridRow.Cells["enabled"].FormattedValue), Minor = ((bool)dataGridRow.Cells["minor"].FormattedValue), IsRegex = ((bool)dataGridRow.Cells["regex"].FormattedValue), BeforeOrAfter = ((bool)dataGridRow.Cells["BeforeOrAfter"].FormattedValue) }; if (dataGridRow.Cells["replace"].Value == null) dataGridRow.Cells["replace"].Value = ""; string f = Encode(dataGridRow.Cells["find"].Value.ToString()); string r = Encode(dataGridRow.Cells["replace"].Value.ToString()); if (!rep.IsRegex) f = Regex.Escape(f); rep.Find = f; rep.Replace = r; if (!(bool)dataGridRow.Cells["casesensitive"].FormattedValue) rep.RegularExpressionOptions |= RegexOptions.IgnoreCase; if ((bool)dataGridRow.Cells["multi"].FormattedValue) rep.RegularExpressionOptions |= RegexOptions.Multiline; if ((bool)dataGridRow.Cells["single"].FormattedValue) rep.RegularExpressionOptions |= RegexOptions.Singleline; rep.Comment = (string)dataGridRow.Cells["comment"].FormattedValue ?? ""; return rep; }
// actualiza fila en grilla private void ActualizarHorarioEnGrilla(DataGridViewRow row, Horario horario) { int indice = row.Index; QuitarHorarioDeGrilla(row); DataGridViewRow newRow = ConstruirRow(horario); dataGridViewHorarios.Rows.Insert(indice, newRow); }
/// <summary> /// Конструктор класса /// </summary> /// <param name="app">Ссылка на платформу</param> /// <param name="pBios">Ссылка на подсистему ввода/вывода платформы</param> public MainForm(IApplication app, IEpromIO pBios, IProtocol protocol) { InitializeComponent(); textInserter = new TextInsert(InsertToText); oldValue = new object(); newValue = new object(); oldValue = "0"; newValue = "0"; bios = new BIOS(app, pBios); proto = protocol; currentState = new ObjectCurrentState(); for (int i = 0; i < 11; i++) { DataGridViewRow r = new DataGridViewRow(); if ((i % 2) == 0) r.DefaultCellStyle.BackColor = Color.WhiteSmoke; dataGridViewCalibrationTable.Rows.Add(r); } syncker = new Sync(); packetSyncMutex = new Mutex(false); gr = new GraphicCalibration(CreateGraphics(), new Rectangle(12, 38, 422, 267)); gr.CalculateScale(); }
private void btnUpdate_Click(object sender, EventArgs e) { DataGridViewRow newrow = new DataGridViewRow(); newrow.CreateCells(dataGridView1); newrow.Cells[0].Value = eventstat.NrOfReg() +" Users"; newrow.Cells[1].Value = eventstat.TickWithDiscount() * 45 + eventstat.TickWithoutDiscount() * 50 + " €"; newrow.Cells[2].Value = eventstat.NrOfCampRented() + " rented camps"; newrow.Cells[3].Value = eventstat.CampRev() + " €"; newrow.Cells[4].Value = eventstat.FoodRev() + " €"; newrow.Cells[5].Value = eventstat.LoanMatRev() + " €"; newrow.Cells[6].Value = eventstat.TickWithDiscount() * 45 + eventstat.TickWithoutDiscount() * 50 + eventstat.CampRev() + eventstat.FoodRev() + eventstat.LoanMatRev() + " €"; dataGridView1.Rows.Add(newrow); textBox2.Text = eventstat.NrOfReg().ToString(); textBox2.BackColor = Color.GreenYellow;// visitors expected textBox7.Text = Convert.ToString(eventstat.NrOfVisPresent()); textBox7.BackColor = Color.GreenYellow;// visitors presents textBox6.Text = (eventstat.NrOfReg() - eventstat.NrOfVisPresent()).ToString(); textBox6.BackColor = Color.GreenYellow;// visitors left textBox3.Text = eventstat.EvAccountBalance().ToString() + " €"; textBox3.BackColor = Color.GreenYellow;// event account balance textBox5.Text = Convert.ToString(150 - eventstat.NrOfCampRented()); textBox5.BackColor = Color.GreenYellow;// Number of free camping spots //textBox12.Text = eventstat.BBurgerSold().ToString(); textBox12.BackColor = Color.GreenYellow;// big burger sold //textBox11.Text = eventstat.CColaSold().ToString(); textBox11.BackColor = Color.GreenYellow;// coca cola sold //textBox9.Text = eventstat.ChickBurgerSold().ToString(); textBox9.BackColor = Color.GreenYellow;// chicken burger sold //textBox13.Text = eventstat.FFriesSold().ToString(); textBox13.BackColor = Color.GreenYellow;// french fries sold //textBox14.Text = eventstat.HBeerSold().ToString(); textBox14.BackColor = Color.GreenYellow;// Heinneken beer sold //textBox15.Text = eventstat.SaladSold().ToString(); textBox15.BackColor = Color.GreenYellow;// Salad sold }
public DataGridViewRow getDataGridViewRow(DataGridView dg, KeeperTracker mt) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dg); string dgIdentifier = this.ident.ToString("X").PadLeft(8, '0') + "h"; string dgRemoteRequest = (this.remote_request?"Yes":"No"); string dgLength = this.data_length.ToString(); string dgData = byteArrayToHexString(this.data, this.data_length); string dgPeriod = mt.getPeriod(this).ToString(); string dgCount = mt.getCount(this).ToString(); string dgTime = mt.getTime(this).ToLongTimeString(); ArrayList a = new ArrayList(); a.Add(dgIdentifier); a.Add(dgRemoteRequest); a.Add(dgLength); a.Add(dgData); a.Add(dgPeriod); a.Add(dgCount); a.Add(dgTime); a.Add(this.ident); a.Add(this); row.SetValues(a.ToArray()); return row; }
private void ApplicationControl_Load(object sender, System.EventArgs e) { Action<string> Add = text => { var r = new DataGridViewRow(); r.Cells.AddText(text); this.dataGridView1.Rows.Add(r); }; Add("foo1"); Add("foo2"); Add("foo3"); Add("foo4"); Add("foo5"); int i = 5; button2.Click += delegate { i++; Add("foox " + i); }; }
private void AddRow(uint index, string text) { DataGridViewRow row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell { Value = index }); row.Cells.Add(new DataGridViewTextBoxCell { Value = text }); m_dgvStrings.Rows.Add(row); }
/// <summary> /// Binds the EPPlus package (or actually only its first worksheet) /// to the DataGridView. /// </summary> private void InitPackageToUI() { var ws = _package.Workbook.Worksheets.First(); var page1 = this.tabControl_Worksheets.Controls[0] as TabPage; page1.Text = ws.Name; var gridView = GetGrid(); InitFonts(gridView); InitEvents(gridView); for (var row = 0; row < ws.Dimension.Rows; row++) { var gridRow = new DataGridViewRow {HeaderCell = {Value = (row + 1).ToString()}}; for (var col = 0; col < NumberOfColumns; col++) { var cell = ws.Cells[row + 1, col + 1]; if (cell.Value!=null) { using (var uiCell = new DataGridViewTextBoxCell()) { uiCell.Value = cell.Value; gridRow.Cells.Add(uiCell); } } } gridView.Rows.Add(gridRow); } gridView.Refresh(); }
private void ExecuteCommand(object sender, params object[] parameters) { var m = ((ToolStripItem)sender).Text.Replace("#", "").Replace(" ", "_"); Row row = gunaDataGridView1.SelectedRows[0]; var ip = row.Cells[0].Value as string; var port = ushort.Parse(row.Cells[1].Value as string); var name = row.Cells[2].Value as string; if (m == "Disconnect") { DisconnectClient(new ClientInfo(ip, port, name)); return; } else if (m == "Restart") { RestartClient(new ClientInfo(ip, port, name)); return; } var method = typeof(Commands.Commands).GetMethod(m); if (method != null) { Commands.Commands.Parameters = parameters; method.Invoke(null, new object[] { new ClientInfo(ip, port, name) }); } else { MessageBox.Show("Command not avaliable yet!", "Send Command", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void butConnect_Click(object sender, EventArgs e) { if (_Connected) { if (_Thread != null) { _Thread.Abort(); _Thread = null; } _Connected = false; butConnect.Text = "Connect"; butRecord.Enabled = false; cbSharedMemName.Enabled = true; DataGridViewRow row = new DataGridViewRow(); if (dgMessages.Rows.Count > 0) { var first = dgMessages.Rows[dgMessages.Rows.GetFirstRow(DataGridViewElementStates.None)].Cells[0]; row.Cells.Add(new DataGridViewTextBoxCell() { Value = first.Value }); } else { row.Cells.Add(new DataGridViewTextBoxCell() { Value = "0" }); } row.Cells.Add(new DataGridViewTextBoxCell() { Value = "" }); row.Cells.Add(new DataGridViewTextBoxCell() { Value = "" }); row.Cells.Add(new DataGridViewTextBoxCell() { Value = "" }); row.Cells.Add(new DataGridViewTextBoxCell() { Value = "" }); row.Cells.Add(new DataGridViewTextBoxCell() { Value = "Disconnected from server" }); row.Cells.Add(new DataGridViewTextBoxCell() { Value = "" }); row.DefaultCellStyle.ForeColor = Color.Red; dgMessages.Rows.Insert(0, row); } else { if (_Thread == null) { var name = cbSharedMemName.Text; _Thread = new Thread(() => { Connect(name); }); _Thread.IsBackground = true; _Thread.Start(); } dgMessages.Rows.Clear(); butConnect.Text = "Connecting..."; butConnect.Enabled = false; cbSharedMemName.Enabled = false; } }
public Registro(DataGridViewRow fila,int cualRegistro) { InitializeComponent(); switch (cualRegistro) { //Alcancias case 0: Herramientas.AbrirEnContainerNewForm(new IngresoAlcancia(fila), splitContainer1.Panel1); break; //Empleados case 1: Herramientas.AbrirEnContainerNewForm(new IngresoEmpleados(fila),splitContainer1.Panel1); break; //Empresas case 2: Herramientas.AbrirEnContainerNewForm(new IngresarEmpresa(fila), splitContainer1.Panel1); break; //Ninos case 3: Herramientas.AbrirEnContainerNewForm(new IngresoNiños(fila), splitContainer1.Panel1); break; //Padrinos case 4: Herramientas.AbrirEnContainerNewForm(new IngresoPadrinos(fila), splitContainer1.Panel1); break; //Voluntarios case 5: Herramientas.AbrirEnContainerNewForm(new IngresoVoluntarios(fila), splitContainer1.Panel1); break; default: break; } }
private void ClientLogWin_Load(object sender, EventArgs e) { foreach (string msg in _log) { string[] p = msg.Split('|'); DataGridViewRow row = new DataGridViewRow(); if (p.Length == 1) { DataGridViewCell cell = new DataGridViewImageCell(); cell.Value = iconList.Images[0]; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = p[0]; row.Cells.Add(cell); } else { DataGridViewCell cell = new DataGridViewImageCell(); cell.Value = iconList.Images[Convert.ToInt32(p[0])]; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = p[1]; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = p[2]; row.Cells.Add(cell); } row.Height = 17; messageList.Rows.Add(row); messageList.FirstDisplayedScrollingRowIndex = messageList.Rows.Count - 1; } }
private void btnSetAccessToken_ItemClick(object sender, ItemClickEventArgs e) { if (dataViewer.dataGridView.SelectedRows.Count > 0) { DataGridViewRow row = dataViewer.dataGridView.SelectedRows[0]; string UID = row.Cells[1].Value.ToString(); var driver = OpenChrome(UID); driver.Navigate().GoToUrl("https://m.facebook.com/composer/ocelot/async_loader/?publisher=feed"); string data = driver.PageSource; Regex regex = new Regex(@"""accessToken\\"":\\""(.*?)\\""", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline); MatchCollection matchCollection = regex.Matches(data); if (matchCollection.Count > 0 && matchCollection[0].Groups.Count > 1) { Settings.Default.AccessToken = matchCollection[0].Groups[1].Value.ToString(); Settings.Default.Save(); } else { MessageBox.Show("Get Access Token Fail!"); } } else { MessageBox.Show("No Account Selected !"); } }
protected override void OnPrimaryKeyChangedComplete(Exception error) { if (error != null) { RTOut.WriteError(error); throw error; } dgvUDT.Rows.Clear(); List<string> udtNames = new List<string>(); foreach (XElement each in UDT.Elements("TableName")) udtNames.Add(each.Value); udtNames.Sort(); foreach (string each in udtNames) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgvUDT, each); dgvUDT.Rows.Add(row); } }
private void SeleccionarCompra(ref DataGridViewRow row) { int cantElegida = Convert.ToInt32(numericUpDown1.Value); System.Windows.Forms.DataGridViewRow rowExi = null; foreach (System.Windows.Forms.DataGridViewRow r in grid.Rows) { if (r.Cells["colCod"].Value == row.Cells["colCod"].Value) { rowExi = r; break; } } if (rowExi != null) { rowExi.Cells["colCantidad"].Value = cantElegida; rowExi.Cells["colPU"].Value = row.Cells["colPrecioCompra"].Value; } else { int idx = grid.Rows.Add(); rowExi = grid.Rows[idx]; rowExi.Cells["colCod"].Value = row.Cells["colCod"].Value; rowExi.Cells["colProducto"].Value = row.Cells["colNombre"].Value; rowExi.Cells["colMarca"].Value = row.Cells["colMarca"].Value; rowExi.Cells["colTalla"].Value = row.Cells["colTalla"].Value; rowExi.Cells["colCantidad"].Value = cantElegida; rowExi.Cells["colPU"].Value = row.Cells["colPrecioCompra"].Value; } }
private void SetRad(ref System.Windows.Forms.DataGridViewRow rad, int teller) { if (teller % nRot == 0) { rad.DividerHeight = 1; } }
public void ConseguirDatosToUpdate(Control controles, DataGridViewRow fila) { ctrlID.Text = fila.Cells[0].Value.ToString(); ctrlNombre.Text = fila.Cells[1].Value.ToString(); ctrlApellido.Text = fila.Cells[2].Value.ToString(); if (fila.Cells[3].Value.ToString() == "Femenino") { ((RadioButton)ctrlGeneroM).Checked = false; ((RadioButton)ctrlGeneroF).Checked = true; } else { ((RadioButton)ctrlGeneroM).Checked = true; ((RadioButton)ctrlGeneroF).Checked = false; } ctrlFechaNacimiento.Text = fila.Cells[4].Value.ToString(); ctrlFechaInicio.Text = fila.Cells[5].Value.ToString(); ctrlTelefono.Text = fila.Cells[6].Value.ToString(); ctrlEmail.Text = fila.Cells[7].Value.ToString(); ctrlHoras.Text = fila.Cells[8].Value.ToString(); ctrlInformacion.Text = fila.Cells[9].Value.ToString(); }
void AddToList(CGoodsData pCGoodsData) { DataGridViewRow r1 = new DataGridViewRow(); // 상품 시퀀스 DataGridViewTextBoxCell cell_seq = new DataGridViewTextBoxCell(); cell_seq.Value = pCGoodsData.Seq_; r1.Cells.Add(cell_seq); // 상품명 DataGridViewTextBoxCell cell_GoodsName = new DataGridViewTextBoxCell(); cell_GoodsName.Value = pCGoodsData.GoodsName_; r1.Cells.Add(cell_GoodsName); // 옵션명 DataGridViewTextBoxCell cell_OptionName = new DataGridViewTextBoxCell(); cell_OptionName.Value = pCGoodsData.OptionName_; r1.Cells.Add(cell_OptionName); // 채널 DataGridViewTextBoxCell cell_Channel = new DataGridViewTextBoxCell(); cell_Channel.Value = pCGoodsData.ChannelName_; r1.Cells.Add(cell_Channel); dataGridView_GoodsList.Rows.Add(r1); }
public ResultTable(DataGridView dataView, string[] names) // constructor. Uses array of names for column/row header labels { m_dataView = dataView; m_results = new Result[m_numberOfSequences, m_numberOfSequences]; for (int i = 0; i < m_numberOfSequences; ++i) { DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn(); column.HeaderText = "seq" + (i+1); column.MaxInputLength = 8; column.Width = 50; DataGridViewCell cell = new DataGridViewTextBoxCell(); column.CellTemplate = cell; m_dataView.Columns.Add(column); } for (int j = 0; j < m_numberOfSequences; ++j) { DataGridViewRow row = new DataGridViewRow(); // how can I remove the dumb current cell pointer that makes the header cells so big/obfuscates the header text? row.HeaderCell.Value = "seq"+(j+1); row.Height = 20; for (int i = 0; i < m_numberOfSequences; ++i) { DataGridViewCell cell = new DataGridViewTextBoxCell(); row.Cells.Add(cell); } dataView.RowHeadersWidthSizeMode=DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; m_dataView.Rows.Add(row); } dataView.CurrentCell = null; }
private void ApplicationControl_Load(object sender, System.EventArgs e) { var rr = this.dataGridView1.Rows.Count; for (int i = 0; i < 7; i++) { var r = new DataGridViewRow(); r.Height = 60; for (int j = 0; j < 7; j++) { r.Cells.AddRange( new DataGridViewTextBoxCell { Value = "world #" + i + "," + j } ); } this.dataGridView1.Rows.AddRange(r); } }
public void dgvRate_Click(object sender, EventArgs e) { System.Windows.Forms.DataGridViewRow with_1 = dgvRate.Rows[dgvRate.CurrentRow.Index]; txtRateID.Text = System.Convert.ToString(with_1.Cells[0].Value); txtCurrency.Text = System.Convert.ToString(with_1.Cells[1].Value); txtRate.Text = System.Convert.ToString(with_1.Cells[2].Value); }
public DgvBrowseFolderCommand(DgvHandler dgvHandler, DataGridViewRow row) : base(dgvHandler) { Init(); currentRow = CloneRow(row); curRowIndex = row.Index; }
public DgvDeleteCommand( DgvHandler dgvHandler, DataGridViewRow row ) : base(dgvHandler) { Init(); this.row = row; this.curRowIndex = row.Index; }
public string getRowState(DataGridViewRow row) { int last = row.Cells.Count - 1; string str = ""; str += row.Cells[last].Value; return str; }
private void dataGridUsers_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 4) { string rowID = dataGridUsers.Rows[e.RowIndex].Cells[0].Value.ToString(); AdminActions.deleteUser(rowID, dataGridUsers); } else if (e.ColumnIndex == 5) { System.Windows.Forms.DataGridViewRow row = dataGridUsers.Rows[e.RowIndex]; AdminActions.updateUser(row, dataGridUsers); } else if (e.ColumnIndex == 6) { string rowID = dataGridUsers.Rows[e.RowIndex].Cells[0].Value.ToString(); string blocked = dataGridUsers.Rows[e.RowIndex].Cells[6].Value.ToString(); AdminActions.blockCard(rowID, blocked, dataGridUsers); AdminActions.fillWithUsers(dataGridUsers); } else if (e.ColumnIndex == 7) { string id = dataGridUsers.Rows[e.RowIndex].Cells[0].Value.ToString(); string adminIndex = dataGridUsers.Rows[e.RowIndex].Cells[7].Value.ToString(); AdminActions.makeAdmin(id, adminIndex, dataGridUsers); AdminActions.fillWithUsers(dataGridUsers); } }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { VacationType VacationType = item as VacationType; row.Tag = VacationType; row.Cells["colName"].Value = VacationType.Name; row.Cells["colMemo"].Value = VacationType.Memo; }
// *********** function to fill tha INVOICE GRID VIEW *************** public void FillInvoiceGrid() { if (vehical_category_data.qty != "") { DataGridViewRow NewRow = new DataGridViewRow(); grdBill.Rows.Add(NewRow); int a = grdBill.RowCount; int catID = vehical_category_data.get_catagory_id(); string brand = vehical_category_data.brand; string size = vehical_category_data.size; string qty = vehical_category_data.qty; string unitPrice = vehical_category_data.unitPrice; double linePrice = Convert.ToDouble(vehical_category_data.unitPrice) * Convert.ToDouble(vehical_category_data.qty); grdBill.Rows[a - 1].Cells[0].Value = catID.ToString(); grdBill.Rows[a - 1].Cells[1].Value = brand + " / " + size; grdBill.Rows[a - 1].Cells[2].Value = qty; grdBill.Rows[a - 1].Cells[3].Value = unitPrice; grdBill.Rows[a - 1].Cells[4].Value = linePrice.ToString(); grdBill.Rows[a - 1].Cells[5].Value = "V"; ; //to calculate invoice total //uses total at vehical_category_data class vehical_category_data.total = linePrice + vehical_category_data.total; txtTotal.Text = vehical_category_data.total.ToString(); vehical_category_data.statusPass2Forms = false; } }
private void AddItems(string[] panels, int sections) { foreach (string panel in panels) { DataGridViewComboBoxCell reff = new DataGridViewComboBoxCell(); DataGridViewTextBoxCell txt2A = new DataGridViewTextBoxCell(); DataGridViewRow dataGridRow = new DataGridViewRow(); //ComboBox reff = new ComboBox(); reff.MaxDropDownItems = sections; //reff.DataSource = txt2A.Value = panel; for (int i = 1; i <= sections; i++) reff.Items.Add(i); try { dataGridRow.Cells.Add(txt2A); dataGridRow.Cells.Add(reff); Grid.Rows.Add(dataGridRow); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); } } }
protected override DataGridViewRow FillRow(Report entity, DataGridViewRow rowToAdd) { rowToAdd.Cells.Add(new DataGridViewTextBoxCell {Value = entity.Id}); rowToAdd.Cells.Add(new DataGridViewTextBoxCell {Value = entity.DateTime.ToPersianDateString()}); rowToAdd.Cells.Add(new DataGridViewTextBoxCell {Value = entity.Title}); return rowToAdd; }
private void dgv_kintai_DragDrop(object sender, DragEventArgs e) { //編集モードになっていない場合は、ドラッグ&ドロップを許可しない if (w_hensyu_flg == 0) { return; } //DragDropイベント発生時のX,Y座標を取得 Point clientPoint = dgv_kintai.PointToClient(new Point(e.X, e.Y)); DataGridView.HitTestInfo hit = dgv_kintai.HitTest(clientPoint.X, clientPoint.Y); //dataGridView2.Rows[hit.RowIndex].Selected = true; // 該当行を選択状態に //ドラッグされているデータが行データ(DataGridViewRow型)で、かつ、 //ドラッグソースのデータはドロップ先に複写するよう指示されている場合(移動等の別の指示ではない場合) if (e.Data.GetDataPresent(typeof(System.Windows.Forms.DataGridViewRow)) && (e.Effect == DragDropEffects.Copy)) { //ドラッグソースの行データ(DataGridViewRow型データ)を取得 System.Windows.Forms.DataGridViewRow Row_Work = (System.Windows.Forms.DataGridViewRow)e.Data.GetData(typeof(System.Windows.Forms.DataGridViewRow)); //ドロップ先としての指定位置が有効な場合(x,y座標値の取得に成功している場合) if (hit.RowIndex != -1) { //行データをdataGridView2の指定行の前に挿入 DataRow w_dt_kintai_row = w_dt_kintai.NewRow(); w_dt_kintai_row["syain_cd"] = Row_Work.Cells[0].Value.ToString(); w_dt_kintai_row["syain_name"] = Row_Work.Cells[1].Value.ToString(); w_dt_kintai_row["kintai_kbn"] = "01"; w_dt_kintai_row["kintai_kbn_name"] = "欠勤"; w_dt_kintai_row["kintai_date1"] = tb_hizuke.Text; w_dt_kintai_row["kintai_time1"] = "08:35"; w_dt_kintai_row["kintai_date2"] = tb_hizuke.Text; w_dt_kintai_row["kintai_time2"] = "17:15"; w_dt_kintai.Rows.InsertAt(w_dt_kintai_row, hit.RowIndex); //追加した行を選択状態にする。 dgv_kintai.Rows[hit.RowIndex].Selected = true; } //ドロップ先としての指定位置が有効でない場合(x,y座標値の取得に失敗した場合) else { //行データをdataGridView2の末尾に追加 DataRow w_dt_kintai_row = w_dt_kintai.NewRow(); w_dt_kintai_row["syain_cd"] = Row_Work.Cells[0].Value.ToString(); w_dt_kintai_row["syain_name"] = Row_Work.Cells[1].Value.ToString(); w_dt_kintai_row["kintai_kbn"] = "01"; w_dt_kintai_row["kintai_kbn_name"] = "欠勤"; w_dt_kintai_row["kintai_date1"] = tb_hizuke.Text; w_dt_kintai_row["kintai_time1"] = "08:35"; w_dt_kintai_row["kintai_date2"] = tb_hizuke.Text; w_dt_kintai_row["kintai_time2"] = "17:15"; w_dt_kintai.Rows.Add(w_dt_kintai_row); } } //ドラッグされているデータが行データ(DataGridViewRow型)ではない場合、 //又はドラッグソースのデータはドロップ先に複写するよう指示されていない場合(複写ではなく移動等の別の指示の場合) else { // 特に処理はなし } }
public static ThietBi DataGridViewRow_to_ThietBi(System.Windows.Forms.DataGridViewRow Input) { ThietBi kq = new ThietBi(); kq.MaThietBi = Input.Cells["MaThietBi"].Value.ToString(); kq.TenThietBi = Input.Cells["TenThietBi"].Value.ToString(); return(kq); }
public static PhanXuong DataGridViewRow_to_PhanXuong(System.Windows.Forms.DataGridViewRow Input) { PhanXuong kq = new PhanXuong(); kq.MaPhanXuong = Input.Cells["MaPhanXuong"].Value.ToString(); kq.TenPhanXuong = Input.Cells["TenPhanXuong"].Value.ToString(); return(kq); }
public static NguonVon DataGridViewRow_to_NguonVon(System.Windows.Forms.DataGridViewRow Input) { NguonVon kq = new NguonVon(); kq.MaNguonVon = Input.Cells["MaNguonVon"].Value.ToString(); kq.TenNguonVon = Input.Cells["TenNguonVon"].Value.ToString(); return(kq); }
public static LoaiTaiSan DataGridViewRow_to_LoaiTaiSan(System.Windows.Forms.DataGridViewRow Input) { LoaiTaiSan kq = new LoaiTaiSan(); kq.MaLoaiTaiSan = Input.Cells["MaLoaiTaiSan"].Value.ToString(); kq.TenLoaiTaiSan = Input.Cells["TenLoaiTaiSan"].Value.ToString(); return(kq); }
public static BoPhanSuDung DataGridViewRow_to_BoPhanSuDung(System.Windows.Forms.DataGridViewRow Input) { BoPhanSuDung kq = new BoPhanSuDung(); kq.MaBoPhanSuDung = Input.Cells["MaBoPhanSuDung"].Value.ToString(); kq.TenBoPhanSuDung = Input.Cells["TenBoPhanSuDung"].Value.ToString(); return(kq); }
public void dgv_Menu_Click(object sender, EventArgs e) { System.Windows.Forms.DataGridViewRow with_1 = dgv_Menu.Rows[dgv_Menu.CurrentRow.Index]; txtID.Text = System.Convert.ToString(with_1.Cells[0].Value); txtName.Text = System.Convert.ToString(with_1.Cells[1].Value); txtPrice.Text = System.Convert.ToString(with_1.Cells[2].Value); pgv.Image = Image.FromFile(System.Convert.ToString(with_1.Cells[3].Value)); txtAmount.Focus(); }
public static BoPhanHachToan DataGridViewRow_to_BoPhanHachToan(System.Windows.Forms.DataGridViewRow Input) { BoPhanHachToan kq = new BoPhanHachToan(); kq.MaBoPhanHachToan = Input.Cells["MaBoPhanHachToan"].Value.ToString(); kq.TenBoPhanHachToan = Input.Cells["TenBoPhanHachToan"].Value.ToString(); //BoPhanHachToan tmp = DANHMUC.BoPhanHachToanFolder.frmDMBoPhanHachToan.Ldata.SingleOrDefault(k => k.MaBoPhanHachToan.ToUpper().Equals(kq.MaBoPhanHachToan.ToUpper())).Copy() ?? new BoPhanHachToan(); return(kq); }
public static PhanNhomTaiSan DataGridViewRow_to_PhanNhomTaiSan(System.Windows.Forms.DataGridViewRow Input) { PhanNhomTaiSan kq = new PhanNhomTaiSan(); kq.MaPhanNhomTaiSan = Input.Cells["MaPhanNhomTaiSan"].Value.ToString(); kq.TenPhanNhomTaiSan = Input.Cells["TenPhanNhomTaiSan"].Value.ToString(); kq.KieuPhanNhomTaiSan = Input.Cells["KieuPhanNhomTaiSan"].Value.ToString(); return(kq); }
public void dgvFood_Click(object sender, EventArgs e) { System.Windows.Forms.DataGridViewRow with_1 = dgvFood.Rows[dgvFood.CurrentRow.Index]; txtid.Text = System.Convert.ToString(with_1.Cells[0].Value); txtname.Text = System.Convert.ToString(with_1.Cells[1].Value); txtprice.Text = System.Convert.ToString(with_1.Cells[2].Value); ptbfood.Image = Image.FromFile(System.Convert.ToString(with_1.Cells[3].Value)); txtamount.Focus(); }
public static LyDoTangGiamTaiSan DataGridViewRow_to_LyDoTangGiamTaiSan(System.Windows.Forms.DataGridViewRow Input) { LyDoTangGiamTaiSan kq = new LyDoTangGiamTaiSan(); //1- tăng tài sản (TRUE), 2- giảm tài sản (FALSE) kq.LoaiTangGiamTaiSan = bool.Parse(Input.Cells["LoaiTangGiamTaiSan"].Value.ToString()); kq.MaLyDoTangGiamTaiSan = Input.Cells["MaLyDoTangGiamTaiSan"].Value.ToString(); kq.TenLyDoTangGiamTaiSan = Input.Cells["TenLyDoTangGiamTaiSan"].Value.ToString(); return(kq); }
public static ThoiKhauHaoTaiSan DataGridViewRow_to_ThoiKhauHaoTaiSan(System.Windows.Forms.DataGridViewRow Input) { int MA = int.Parse(Input.Cells["ThoiKhauHaoTaiSanID"].Value.ToString()); if (NGHIEPVU.ThoiKhauHaoTaiSanFolder.frmNVThoiKhauHaoTaiSan.Ldata == null || NGHIEPVU.ThoiKhauHaoTaiSanFolder.frmNVThoiKhauHaoTaiSan.Ldata.Count == 0) { NGHIEPVU.ThoiKhauHaoTaiSanFolder.frmNVThoiKhauHaoTaiSan.Ldata = VNA_Project.BIZ.ThoiKhauHaoTaiSanBiz.getListThoiKhauHaoTaiSan(); } return(NGHIEPVU.ThoiKhauHaoTaiSanFolder.frmNVThoiKhauHaoTaiSan.Ldata.SingleOrDefault(k => k.ThoiKhauHaoTaiSanID == MA).Copy() ?? new ThoiKhauHaoTaiSan()); }
public static GiamTaiSanCoDinh DataGridViewRow_to_GiamTaiSanCoDinh(System.Windows.Forms.DataGridViewRow Input) { int MA = int.Parse(Input.Cells["GiamTaiSanCoDinhID"].Value.ToString()); if (NGHIEPVU.GiamTaiSanCoDinhFolder.frmNVGiamTaiSanCoDinh.Ldata == null || NGHIEPVU.GiamTaiSanCoDinhFolder.frmNVGiamTaiSanCoDinh.Ldata.Count == 0) { NGHIEPVU.GiamTaiSanCoDinhFolder.frmNVGiamTaiSanCoDinh.Ldata = VNA_Project.BIZ.GiamTaiSanCoDinhBiz.getListGiamTaiSanCoDinh(); } return(NGHIEPVU.GiamTaiSanCoDinhFolder.frmNVGiamTaiSanCoDinh.Ldata.SingleOrDefault(k => k.GiamTaiSanCoDinhID == MA).Copy() ?? new GiamTaiSanCoDinh()); }
public static TaiSan DataGridViewRow_to_TaiSan(System.Windows.Forms.DataGridViewRow Input) { string MA = Input.Cells["MaTaiSan"].Value.ToString(); if (DANHMUC.TaiSanFolder.frmDMTaiSan.Ldata == null || DANHMUC.TaiSanFolder.frmDMTaiSan.Ldata.Count == 0) { DANHMUC.TaiSanFolder.frmDMTaiSan.Ldata = VNA_Project.BIZ.TaiSanBiz.getListTaiSan(); } return(DANHMUC.TaiSanFolder.frmDMTaiSan.Ldata.SingleOrDefault(k => k.MaTaiSan.ToUpper().Equals(MA.ToUpper())).Copy() ?? new TaiSan()); }
protected override void DoDragDrop(object sender, System.Windows.Forms.DataGridViewRow sourceRow, System.Windows.Forms.DataGridViewRow targetRow, System.Windows.Forms.DragEventArgs e) { MethodReference sourceExc = sourceRow.DataBoundItem as MethodReference; MethodReference targetExc = targetRow.DataBoundItem as MethodReference; if (sourceExc != targetExc) { OwnerDefinition.Overrides.Remove(sourceExc); OwnerDefinition.Overrides.Insert(targetRow.Index, sourceExc); RaiseGridUpdated(); } }
private void dgvEmployee_Click(object sender, EventArgs e) { System.Windows.Forms.DataGridViewRow with_1 = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index]; txtID1.Text = System.Convert.ToString(with_1.Cells[0].Value); cbfoodGroup.Text = System.Convert.ToString(with_1.Cells[1].Value); cbFoodType.Text = System.Convert.ToString(with_1.Cells[2].Value); txtName1.Text = System.Convert.ToString(with_1.Cells[3].Value); cbUnit.Text = System.Convert.ToString(with_1.Cells[4].Value); txtPrice1.Text = System.Convert.ToString(with_1.Cells[5].Value); txtPath1.Text = System.Convert.ToString(with_1.Cells[6].Value); ptbProfile.Image = Image.FromFile(txtPath1.Text); }
protected override void DoDragDrop(object sender, System.Windows.Forms.DataGridViewRow sourceRow, System.Windows.Forms.DataGridViewRow targetRow, System.Windows.Forms.DragEventArgs e) { var sourceCattr = sourceRow.DataBoundItem as CustomAttribute; var targetCattr = targetRow.DataBoundItem as CustomAttribute; if (sourceCattr != targetCattr) { OwnerDefinition.CustomAttributes.Remove(sourceCattr); OwnerDefinition.CustomAttributes.Insert(targetRow.Index, sourceCattr); RaiseGridUpdated(); } }
protected override void DoDragDrop(object sender, System.Windows.Forms.DataGridViewRow sourceRow, System.Windows.Forms.DataGridViewRow targetRow, System.Windows.Forms.DragEventArgs e) { var sourceCattra = sourceRow.DataBoundItem as CustomAttributeArgument?; var targetCattra = targetRow.DataBoundItem as CustomAttributeArgument?; if (sourceCattra.HasValue && targetCattra.HasValue && !sourceCattra.Value.Equals(targetCattra.Value)) { OwnerDefinition.ConstructorArguments.Remove(sourceCattra.Value); OwnerDefinition.ConstructorArguments.Insert(targetRow.Index, sourceCattra.Value); RaiseGridUpdated(); } }
protected override void DoDragDrop(object sender, System.Windows.Forms.DataGridViewRow sourceRow, System.Windows.Forms.DataGridViewRow targetRow, System.Windows.Forms.DragEventArgs e) { ExceptionHandler sourceExc = sourceRow.DataBoundItem as ExceptionHandler; ExceptionHandler targetExc = targetRow.DataBoundItem as ExceptionHandler; if (sourceExc != targetExc) { OwnerDefinition.Body.ExceptionHandlers.Remove(sourceExc); OwnerDefinition.Body.ExceptionHandlers.Insert(targetRow.Index, sourceExc); RaiseGridUpdated(); } }
private void Log_File_Load(object sender, System.EventArgs e) { switch (Convert.ToInt32(mcText)) { case 0: B_User.Enabled = false; Button_1.Enabled = false; Button_2.Enabled = false; break; case 1: B_User.Enabled = true; Button_1.Enabled = true; Button_2.Enabled = true; break; case 2: L_User.Visible = false; B_User.Visible = false; User.Visible = false; break; } this.Cursor = Cursors.WaitCursor; Dv.Rows.Clear(); Dv.Columns.Clear(); Dv.Columns.Add("row", "ردیف"); Dv.Columns.Add("Log_Date", "تاریخ"); Dv.Columns.Add("Log_Time", "زمان"); Dv.Columns.Add("Log_Operation", "شرح عملیات"); Dv.Columns.Add("Log_User_Id", "کاربر"); Dv.Columns.Add("Log_Details", ""); Dv.Columns["Log_Details"].Visible = false; Dv.Columns["row"].Width = 50; Dv.Columns["Log_Date"].Width = 100; Dv.Columns["Log_Time"].Width = 120; Dv.Columns["Log_Operation"].Width = 200; Dv.Columns["Log_User_Id"].Width = 220; Dv.AllowUserToAddRows = false; Dv.EditMode = DataGridViewEditMode.EditProgrammatically; DataSet serch = data.PDataset("select A.*,B.* from Log_File A left join Security_Users B on A.Log_User_Id=B.Id where A.Log_Process='" + mbText + "' and A.Log_Table='" + maText + "'"); Id_Code.Text = serch.Tables[0].Rows.Count + "مورد"; foreach (DataRow Dr in serch.Tables[0].Rows) { Dv.Rows.Add(); System.Windows.Forms.DataGridViewRow tempVar = Dv.Rows[Dv.Rows.Count - 1]; tempVar.Cells["row"].Value = Dv.Rows.Count; tempVar.Cells["Log_Date"].Value = (Dr["Log_Date"]).ToString().Substring(0, 4) + "/" + (Dr["Log_Date"]).ToString().Substring(4, 2) + "/" + (Dr["Log_Date"]).ToString().Substring(6, 2); tempVar.Cells["Log_Time"].Value = Dr["Log_Time"]; tempVar.Cells["Log_Operation"].Value = Dr["Log_Operation"]; tempVar.Cells["Log_User_Id"].Value = Dr["Username"]; tempVar.Cells["Log_Details"].Value = Dr["Log_Details"]; } this.Cursor = Cursors.Default; }
private void RowAdding_Click(object sender, EventArgs e) { DataGridViewRow row = new System.Windows.Forms.DataGridViewRow(); if (dataGridView.Columns.Count == 0) { MessageBox.Show("There are no columns!"); return; } dataGridView.Rows.Add(row); dataGridView.Rows[table.RowCount].HeaderCell.Value = (table.RowCount).ToString(); table.AddRow(dataGridView); }
private void buttonAddRow_Click(object sender, EventArgs e) { DataGridViewRow row = new System.Windows.Forms.DataGridViewRow(); if (dataGridView1.Columns.Count == 0) { MessageBox.Show("Нема стовбців!"); return; } dataGridView1.Rows.Add(row); dataGridView1.Rows[table.rowCount].HeaderCell.Value = (table.rowCount).ToString(); table.AddRow(dataGridView1); }
private void SeleccionarVenta(ref DataGridViewRow row) { Console.WriteLine("====== PRODUCTO SELECCIONADO PARA VENTA"); int cantElegida = Convert.ToInt32(numericUpDown1.Value); int stockActual = Convert.ToInt32(row.Cells["colStock"].Value); if (stockActual < 1 || stockActual < cantElegida) { MetroFramework.MetroMessageBox.Show(this, "Este producto no puede ser seleccionado, acaba de agotar las existencias!"); return; } int dif = stockActual - cantElegida; if (dif > stockActual) { MetroFramework.MetroMessageBox.Show(this, "No hay suficientes existencias!"); return; } System.Windows.Forms.DataGridViewRow rowExi = null; foreach (System.Windows.Forms.DataGridViewRow r in grid.Rows) { if (r.Cells["colCod"].Value == row.Cells["colCod"].Value) { rowExi = r; break; } } if (rowExi != null) { int cantActual = Convert.ToInt32(rowExi.Cells["colCantidad"].Value); rowExi.Cells["colCantidad"].Value = cantActual + cantElegida; rowExi.Cells["colPU"].Value = row.Cells["colPrecioVenta"].Value; } else { int idx = grid.Rows.Add(); rowExi = grid.Rows[idx]; rowExi.Cells["colCod"].Value = row.Cells["colCod"].Value; rowExi.Cells["colProducto"].Value = row.Cells["colNombre"].Value; rowExi.Cells["colMarca"].Value = row.Cells["colMarca"].Value; rowExi.Cells["colTalla"].Value = row.Cells["colTalla"].Value; rowExi.Cells["colCantidad"].Value = cantElegida; rowExi.Cells["colPU"].Value = row.Cells["colPrecioVenta"].Value; } row.Cells["colStock"].Value = dif; }
public void dgvEmployee_Click(object sender, EventArgs e) { System.Windows.Forms.DataGridViewRow with_1 = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index]; txtEmployeeID.Text = System.Convert.ToString(with_1.Cells[0].Value); txtEmployeeName.Text = System.Convert.ToString(with_1.Cells[1].Value); txtEmployeeLastName.Text = System.Convert.ToString(with_1.Cells[2].Value); dtbDob.Text = System.Convert.ToString(with_1.Cells[3].Value); txtEmployeePosition.Text = System.Convert.ToString(with_1.Cells[4].Value); txtEmployeeTel.Text = System.Convert.ToString(with_1.Cells[5].Value); txtEmployeeParentTel.Text = System.Convert.ToString(with_1.Cells[6].Value); txtEmployeeEmail.Text = System.Convert.ToString(with_1.Cells[7].Value); txtEmployeeVillage.Text = System.Convert.ToString(with_1.Cells[8].Value); txtEmployeeDistrict.Text = System.Convert.ToString(with_1.Cells[9].Value); cbProvince.Text = System.Convert.ToString(with_1.Cells[10].Value); txtEmployeeSalary.Text = System.Convert.ToString(with_1.Cells[11].Value); txtPicturePath.Text = System.Convert.ToString(with_1.Cells[12].Value); ptbProfile.ImageLocation = txtPicturePath.Text; }
private void AddElementToDataGridView(Param element) { var row = new DataGridViewRow(); // пустая сточка означет разделитель между // отдельными интерфейсами if(element.ParamName == string.Empty) { dataGridView1.Rows.Add(row); return; } // добавляем первую ячейку var cell1 = new DataGridViewTextBoxCell() { Value = element.ParamName + ":" }; cell1.Style.Font = new Font(dataGridView1.Font, FontStyle.Bold); row.Cells.Add(cell1); // добавляем вторую ячейку var cell2 = new DataGridViewTextBoxCell() { Value = element.ParamValue }; row.Cells.Add(cell2); // добавляем строчку в dataGridView dataGridView1.Rows.Add(row); }