protected DialogResult requestData(RequestScenario scenario, string[] texts) { // texts[0] - requestFormCaption // texts[1] - requestLabelText // texts[2] - comboboxValuesSql using (fRequest requestForm = new fRequest(scenario, texts)) { requestForm.ShowDialog(); return(requestForm.DialogResult); } }
public fRequest(RequestScenario scenario, string[] texts) { InitializeComponent(); this.scenarijus = scenario; switch (this.scenarijus) { case RequestScenario.text_textbox: this.txbText = new System.Windows.Forms.TextBox(); this.txbText.Location = new System.Drawing.Point(Settings.Default.requestBoxLocationX, Settings.Default.requestBoxLocationY); this.txbText.Name = "txbText"; this.txbText.Size = new System.Drawing.Size(Settings.Default.requestStringTextBoxSizeX, Settings.Default.requestStringTextBoxSizeY); this.txbText.TextAlign = HorizontalAlignment.Left; this.txbText.TabIndex = 1; this.txbText.TabStop = true; this.Controls.Add(this.txbText); break; case RequestScenario.integer_combobox: this.cmbInt = new System.Windows.Forms.ComboBox(); this.cmbInt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbInt.FormattingEnabled = true; this.cmbInt.Location = new System.Drawing.Point(Settings.Default.requestBoxLocationX, Settings.Default.requestBoxLocationY); this.cmbInt.Name = "cmbInt"; this.cmbInt.Size = new System.Drawing.Size(Settings.Default.requestComboBoxSizeX, Settings.Default.requestComboBoxSizeY); this.cmbInt.TabIndex = 1; this.cmbInt.TabStop = true; this.Controls.Add(this.cmbInt); try { this.cmbInt.DataSource = DbHelper.FillDataTable(texts[2]); } catch { Msg.ErrorMsg(Messages.DbErrorMsg); return; } this.cmbInt.ValueMember = "valueMember"; this.cmbInt.DisplayMember = "displayMember"; break; case RequestScenario.integer_textbox: this.txbText = new System.Windows.Forms.TextBox(); this.txbText.Location = new System.Drawing.Point(Settings.Default.requestBoxLocationX, Settings.Default.requestBoxLocationY); this.txbText.Name = "txbText"; this.txbText.Size = new System.Drawing.Size(Settings.Default.requestIntTextBoxSizeX, Settings.Default.requestIntTextBoxSizeY); this.txbText.TextAlign = HorizontalAlignment.Right; this.txbText.TabIndex = 1; this.txbText.TabStop = true; this.Controls.Add(this.txbText); break; } Program.pubString = string.Empty; Program.pubInt = -1; this.Text = texts[0]; lblRequest.Text = texts[1]; }