public static void Invoke_ComboBox_DataSource(C1Combo cmb, DataTable dt, string strDisplayMember) { if (cmb.InvokeRequired) { cmb.Invoke(new delInvoke_ComboBox_DataSource(Invoke_ComboBox_DataSource), new object[] { cmb, dt, strDisplayMember }); return; } cmb.DisplayMember = strDisplayMember; cmb.DataSource = dt; //cmb.SelectedIndex = -1; }
//Valida que los combos de component one tenga un dato por defecto descartando valores nulos //que puedan dar errores public static object Validate(C1Combo objC1Combo, object defaultValue) { object _objTmp = null; object _objValue = null; _objTmp = objC1Combo.SelectedValue; if (_objTmp == null) { _objValue = defaultValue; } else { _objValue = objC1Combo.SelectedValue; } return(_objValue); }
public void FillC1Combo(C1Combo objC1Combo, DataTable dataSource, string displayMember, string valueMember) { objC1Combo.DataMode = DataModeEnum.Normal; objC1Combo.ResetText(); objC1Combo.AutoCompletion = true; objC1Combo.MatchCol = MatchColEnum.CurrentMousePos; objC1Combo.MatchEntry = MatchEntryEnum.Standard; objC1Combo.HoldFields(); objC1Combo.ColumnHeaders = false; objC1Combo.DataSource = dataSource; objC1Combo.DisplayMember = displayMember; objC1Combo.ValueMember = valueMember; objC1Combo.MaxDropDownItems = 20; if (dataSource.Rows.Count != 0) { objC1Combo.SelectedIndex = 0; } }
private void InitializeComponent() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(FRCTR)); this.cancelButton = new Button(); this.okButton = new Button(); this.dateTimePicker1 = new DateTimePicker(); this.dateTimePicker2 = new DateTimePicker(); this.label1 = new Label(); this.label2 = new Label(); this.label3 = new Label(); this.c1Report1 = new C1Report(); this.c1Combo1 = new C1Combo(); this.txtTGCT = new TextBox(); this.txtDonGia = new TextBox(); this.label4 = new Label(); this.label5 = new Label(); ((ISupportInitialize)this.c1Report1).BeginInit(); ((ISupportInitialize)this.c1Combo1).BeginInit(); base.SuspendLayout(); this.cancelButton.DialogResult = DialogResult.Cancel; this.cancelButton.Location = new Point(159, 163); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new Size(95, 25); this.cancelButton.TabIndex = 9; this.cancelButton.Text = "Cancel"; this.cancelButton.UseVisualStyleBackColor = true; this.cancelButton.Click += new EventHandler(this.cancelButton_Click); this.okButton.Location = new Point(58, 163); this.okButton.Name = "okButton"; this.okButton.Size = new Size(95, 25); this.okButton.TabIndex = 8; this.okButton.Text = "OK"; this.okButton.UseVisualStyleBackColor = true; this.okButton.Click += new EventHandler(this.okButton_Click); this.dateTimePicker1.CustomFormat = "dd/MM/yyyy"; this.dateTimePicker1.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); this.dateTimePicker1.Format = DateTimePickerFormat.Custom; this.dateTimePicker1.Location = new Point(120, 13); this.dateTimePicker1.Name = "dateTimePicker1"; this.dateTimePicker1.Size = new Size(159, 21); this.dateTimePicker1.TabIndex = 10; this.dateTimePicker2.CustomFormat = "dd/MM/yyyy"; this.dateTimePicker2.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); this.dateTimePicker2.Format = DateTimePickerFormat.Custom; this.dateTimePicker2.Location = new Point(120, 43); this.dateTimePicker2.Name = "dateTimePicker2"; this.dateTimePicker2.Size = new Size(159, 21); this.dateTimePicker2.TabIndex = 11; this.label1.AutoSize = true; this.label1.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); this.label1.Location = new Point(13, 13); this.label1.Name = "label1"; this.label1.Size = new Size(53, 15); this.label1.TabIndex = 12; this.label1.Text = "Từ ngày:"; this.label2.AutoSize = true; this.label2.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); this.label2.Location = new Point(13, 43); this.label2.Name = "label2"; this.label2.Size = new Size(62, 15); this.label2.TabIndex = 12; this.label2.Text = "Đến ngày:"; this.label3.AutoSize = true; this.label3.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); this.label3.Location = new Point(13, 73); this.label3.Name = "label3"; this.label3.Size = new Size(50, 15); this.label3.TabIndex = 13; this.label3.Text = "Khu vực"; this.c1Report1.ReportDefinition = componentResourceManager.GetString("c1Report1.ReportDefinition"); this.c1Report1.ReportName = "c1Report1"; this.c1Combo1.AddItemSeparator = ';'; this.c1Combo1.Caption = ""; this.c1Combo1.CaptionHeight = 17; this.c1Combo1.CharacterCasing = CharacterCasing.Normal; this.c1Combo1.ColumnCaptionHeight = 17; this.c1Combo1.ColumnFooterHeight = 17; this.c1Combo1.ContentHeight = 15; this.c1Combo1.DeadAreaBackColor = Color.Empty; this.c1Combo1.EditorBackColor = SystemColors.Window; this.c1Combo1.EditorFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0); this.c1Combo1.EditorForeColor = SystemColors.WindowText; this.c1Combo1.EditorHeight = 15; this.c1Combo1.Images.Add((Image)componentResourceManager.GetObject("c1Combo1.Images")); this.c1Combo1.ItemHeight = 15; this.c1Combo1.Location = new Point(120, 73); this.c1Combo1.MatchEntryTimeout = 2000L; this.c1Combo1.MaxDropDownItems = 5; this.c1Combo1.MaxLength = 32767; this.c1Combo1.MouseCursor = Cursors.Default; this.c1Combo1.Name = "c1Combo1"; this.c1Combo1.RowSubDividerColor = Color.DarkGray; this.c1Combo1.Size = new Size(159, 21); this.c1Combo1.TabIndex = 14; this.c1Combo1.PropBag = componentResourceManager.GetString("c1Combo1.PropBag"); this.txtTGCT.Location = new Point(120, 103); this.txtTGCT.Name = "txtTGCT"; this.txtTGCT.Size = new Size(159, 20); this.txtTGCT.TabIndex = 15; this.txtDonGia.Location = new Point(119, 132); this.txtDonGia.Name = "txtDonGia"; this.txtDonGia.Size = new Size(159, 20); this.txtDonGia.TabIndex = 16; this.label4.AutoSize = true; this.label4.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); this.label4.Location = new Point(13, 103); this.label4.Name = "label4"; this.label4.Size = new Size(101, 15); this.label4.TabIndex = 17; this.label4.Text = "Thời gian chế tạo"; this.label5.AutoSize = true; this.label5.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); this.label5.Location = new Point(13, 133); this.label5.Name = "label5"; this.label5.Size = new Size(50, 15); this.label5.TabIndex = 18; this.label5.Text = "Đơn giá"; base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(306, 197); base.Controls.Add(this.label5); base.Controls.Add(this.label4); base.Controls.Add(this.txtDonGia); base.Controls.Add(this.txtTGCT); base.Controls.Add(this.c1Combo1); base.Controls.Add(this.label3); base.Controls.Add(this.label2); base.Controls.Add(this.label1); base.Controls.Add(this.dateTimePicker2); base.Controls.Add(this.dateTimePicker1); base.Controls.Add(this.cancelButton); base.Controls.Add(this.okButton); base.FormBorderStyle = FormBorderStyle.FixedSingle; base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon"); base.MaximizeBox = false; base.MinimizeBox = false; base.Name = "FRCTR"; base.StartPosition = FormStartPosition.CenterScreen; this.Text = "FRCBR"; base.Load += new EventHandler(this.FRCTR_Load); ((ISupportInitialize)this.c1Report1).EndInit(); ((ISupportInitialize)this.c1Combo1).EndInit(); base.ResumeLayout(false); base.PerformLayout(); }