//</snippet1> //<snippet2> // This method is called when the user changes his or her selection. // It searches for all occurrences of the selected employee's // name in the Items array and adds the employee's name and // the number of occurrences to TextBox1.Text. // CAUTION This code exposes a known bug: If the index passed to the // FindStringExact(searchString, index) method is the last index // of the array, the code throws an exception. private void ComboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { ComboBox comboBox = (ComboBox)sender; // Save the selected employee's name, because we will remove // the employee's name from the list. string selectedEmployee = (string)ComboBox1.SelectedItem; int count = 0; int resultIndex = -1; // Call the FindStringExact method to find the first // occurrence in the list. resultIndex = ComboBox1.FindStringExact(selectedEmployee); // Remove the name as it is found, and increment the found count. // Then call the FindStringExact method again, passing in the // index of the current found item so the search starts there // instead of at the beginning of the list. while (resultIndex != -1) { ComboBox1.Items.RemoveAt(resultIndex); count += 1; resultIndex = ComboBox1.FindStringExact(selectedEmployee, resultIndex); } // Update the text in Textbox1. TextBox1.Text = TextBox1.Text + "\r\n" + selectedEmployee + ": " + count; }
private void tvwCondition_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { if (e.Node is TreeNodes.FunctionExecution) { grpElement.Text = "Function execution"; TreeNodes.FunctionExecution node = (TreeNodes.FunctionExecution)e.Node; txtValue.Visible = false; cmbInternalFunctions.Visible = true; cmbInternalFunctions.SelectedIndex = cmbInternalFunctions.FindStringExact(node.ApplyBaseDefinition.FunctionId); label2.Text = "FunctionId:"; cmbDataType.Enabled = false; } else if (e.Node is TreeNodes.FunctionParameter) { grpElement.Text = "Function parameter"; TreeNodes.FunctionParameter node = (TreeNodes.FunctionParameter)e.Node; txtValue.Visible = false; cmbInternalFunctions.Visible = true; cmbInternalFunctions.SelectedIndex = cmbInternalFunctions.FindStringExact(node.FunctionDefinition.FunctionId); label2.Text = "FunctionId:"; cmbDataType.Enabled = false; } else if (e.Node is TreeNodes.AttributeValue) { grpElement.Text = "Attribute value"; TreeNodes.AttributeValue node = (TreeNodes.AttributeValue)e.Node; txtValue.Visible = true; cmbInternalFunctions.Visible = false; txtValue.Text = node.AttributeValueDefinition.Contents; label2.Text = "Value:"; cmbDataType.Enabled = true; cmbDataType.SelectedIndex = cmbDataType.FindStringExact(node.AttributeValueDefinition.DataType); } else if (e.Node is TreeNodes.AttributeDesignator) { grpElement.Text = "Attribute designator"; TreeNodes.AttributeDesignator node = (TreeNodes.AttributeDesignator)e.Node; txtValue.Visible = true; cmbInternalFunctions.Visible = false; txtValue.Text = node.AttributeDesignatorDefinition.AttributeId; label2.Text = "AttributeId:"; cmbDataType.Enabled = true; cmbDataType.SelectedIndex = cmbDataType.FindStringExact(node.AttributeDesignatorDefinition.DataType); } else if (e.Node is TreeNodes.AttributeSelector) { grpElement.Text = "Attribute selector"; TreeNodes.AttributeSelector node = (TreeNodes.AttributeSelector)e.Node; txtValue.Visible = true; cmbInternalFunctions.Visible = false; txtValue.Text = node.AttributeSelectorDefinition.RequestContextPath; label2.Text = "XPath:"; cmbDataType.Enabled = false; } }
private void ResetBoxes(Gui.ComboBox gradeBox, Gui.ComboBox colorBox, Gui.ComboBox wallBox, Gui.ComboBox setterBox) { gradeBox.SelectedIndex = gradeBox.FindStringExact("Grade:"); colorBox.SelectedIndex = colorBox.FindStringExact("Color:"); wallBox.SelectedIndex = wallBox.FindStringExact("Wall:"); setterBox.SelectedIndex = setterBox.FindStringExact("Setter:"); }
private void WzPageResourceSetup2_Load(object sender, System.EventArgs e) { string[] strFunctoidCategories = Enum.GetNames(typeof(FunctoidCategory)); try { if (_IsLoaded) { return; } foreach (string strFunctoidCategory in strFunctoidCategories) { cmbCategory.Items.Add(strFunctoidCategory); } cmbCategory.SelectedIndex = cmbCategory.FindStringExact("String"); AddWizardResult(WizardValues.FunctoidCategory, cmbCategory.SelectedItem.ToString()); _IsLoaded = true; } catch (Exception err) { MessageBox.Show(err.Message); Trace.WriteLine(err.Message + Environment.NewLine + err.StackTrace); } }
private void weatherLocations_SelectedIndexChanged(object sender, System.EventArgs e) { // Enable and disable sections based on index selection bool enabled = (forecastRegions.SelectedIndex != -1); btnRemove.Enabled = enabled; unitBox.Enabled = enabled; forecastGroup.Enabled = enabled; radarGroup.Enabled = enabled; if (forecastRegions.SelectedIndex != -1) { WeatherRegionForecast region = (WeatherRegionForecast)forecastRegions.Items[forecastRegions.SelectedIndex]; forecastDays.Value = Convert.ToDecimal(region.ForecastDays); rbUnitMetric.Checked = region.IsMetric; rbUnitStandard.Checked = !region.IsMetric; // Find the url in the region map list DataTable dt = (DataTable)radarMap.DataSource; DataRow[] dr = dt.Select("url='" + region.RadarMap + "'"); if (dr.Length == 1) { radarMap.Text = ""; radarMap.SelectedIndex = radarMap.FindStringExact(dr[0]["name"].ToString()); } else { radarMap.SelectedIndex = -1; radarMap.Text = region.RadarMap; } } }
private void BaseDatabaseGenerateForm_Load(object sender, EventArgs e) { config = this.DefaultConfig; GetSetting(); this.propertyGridSetting.SelectedObject = config; CodeGenerateUIHelper.BindDataBaseToComboBox(this.myMeta, this.cmbSelectDataBase); if (!string.IsNullOrEmpty(this.GetDefaultDataBaseName())) { cmbSelectDataBase.SelectedIndex = cmbSelectDataBase.FindStringExact(this.GetDefaultDataBaseName()); } //MessageBox.Show(GetDefaultSelectObject().Count.ToString()); if (GetDefaultSelectTables() != null && GetDefaultSelectTables().Count > 0) { selectTables = GetDefaultSelectTables(); SelectCustomerTables(); } if (GetDefaultSelectViews() != null && GetDefaultSelectViews().Count > 0) { selectViews = GetDefaultSelectViews(); SelectCustomerViews(); } if (GetDefaultSelectProceduces() != null && GetDefaultSelectProceduces().Count > 0) { selectProceduces = GetDefaultSelectProceduces(); SelectCustomerProceduces(); } }
private void InitializeStylesComboBox() { // ==================================================================== // Set the Style combo box. This one can have a style that isn't defined // yet. If so, it will show in a different color. // (This list only shows the Character styles.) cbStyle.Items.Clear(); cbStyle.Items.Add(NoChange); cbStyle.SelectedItem = NoChange; cbStyle.Text = NoChange; FdoOwningCollection <IStStyle> oc = m_cache.LangProject.LexDbOA.StylesOC; if (oc == null || oc.Count < 1) { System.Diagnostics.Debug.WriteLine("No style info retrieved from the cache."); } foreach (StStyle style in oc) { if (StyleType.kstCharacter == style.Type) { int pos = cbStyle.Items.Add(style.Name); if (style.Name == m_inlineMarker.Style) { cbStyle.SelectedIndex = pos; cbStyle.SelectedItem = style.Name; } } } // if there's a Style in the Marker - select it or set it as unique, otherwise select noChange if (!m_inlineMarker.HasStyle) { cbStyle.SelectedItem = NoChange; } else { int foundPos = cbStyle.FindStringExact(m_inlineMarker.Style); if (foundPos >= 0) { // select the item in the combo that matches cbStyle.SelectedItem = m_inlineMarker.Style; } else { // just put it in the text box and set the color cbStyle.Text = m_inlineMarker.Style; cbStyle.ForeColor = System.Drawing.Color.Blue; } if (cbStyle.Text.Trim().Length == 0) { cbStyle.SelectedItem = NoChange; cbStyle.Text = NoChange; } } }
public static void Check_Item_Exist_In_Combo(System.Windows.Forms.ComboBox cmb) { int indx = cmb.FindStringExact(cmb.Text); if (indx >= 0) { } else { cmb.Text = ""; } }
private bool SetCurrentProject(string projectFileName) { int ItemIndex = cbProject.FindStringExact(projectFileName, -1); if (ItemIndex > -1) { cbProject.SelectedIndex = ItemIndex; SetProjectFields(); return(true); } return(false); }
public void Init(Sfm2Xml.ClsInFieldMarker ifm, Hashtable uiLangsHT, FDO.FdoCache cache) { CheckDisposed(); if (ifm == null) { ifm = new Sfm2Xml.ClsInFieldMarker(); } m_inlineMarker = ifm; m_uiLangs = uiLangsHT; m_cache = cache; // ==================================================================== // Set the language descriptor combo box. This is a DropList so that // the entered text can't be different from the contents of the list. // If the user wants a new language descriptor they have to add one. cbLangDesc.Items.Add(NoChange); cbLangDesc.SelectedItem = NoChange; foreach (DictionaryEntry lang in m_uiLangs) { Sfm2Xml.LanguageInfoUI langInfo = lang.Value as Sfm2Xml.LanguageInfoUI; // make sure there is only one entry for each writing system (especially 'ignore') if (cbLangDesc.FindStringExact(langInfo.ToString()) < 0) { cbLangDesc.Items.Add(langInfo); if (langInfo.FwName == m_inlineMarker.Language) { cbLangDesc.SelectedItem = langInfo; } } } InitializeStylesComboBox(); HideOKBtn(); // see if it needs to be visible or not }
public ResolutionForm() { InitializeComponent(); Statics.Localizations.Apply(this); cmbRes.ContextMenu = DudMenu; if (Fullscreen) { tbWidth.Enabled = false; tbHeight.Enabled = false; } else { lArbRes.Visible = false; } tbWidth.Text = sWidth.ToString(); tbHeight.Text = sHeight.ToString(); cmbRefreshRate.Items.Add(Statics.strings["Default"]); foreach (Resolution p in Resolutions) { cmbRes.Items.Add(p); if (p.X == sWidth && p.Y == sHeight) { cmbRes.SelectedIndex = cmbRes.Items.Count - 1; } } cmbRefreshRate.SelectedIndex = cmbRefreshRate.FindStringExact(sRefresh.ToString()); if (cmbRefreshRate.SelectedIndex == -1) { cmbRefreshRate.SelectedIndex = 0; } }
/// <summary> /// Adds/selects the specified server in the combo box. /// </summary> public void OnConnect(OpcServer server) { // check if the server url already exists. int index = ServerUrlCB.FindStringExact(server.Url.ToString()); // add url if it does not exist. if (index == -1) { index = 1; ServerUrlCB.Items.Insert(index, server.Url); } // select the new url. ServerUrlCB.SelectedIndex = index; }
static internal void SetItemByDisplayValue(System.Windows.Forms.ComboBox comboBox, string displayValue, SelectedItemOptions options = SelectedItemOptions.None) { if (comboBox.Items.Count == 0) { return; } int index = comboBox.FindStringExact(displayValue); if (index == -1) { switch (options) { case SelectedItemOptions.None: comboBox.SelectedIndex = -1; break; case SelectedItemOptions.First: comboBox.SelectedIndex = 0; break; case SelectedItemOptions.NoneOrFirstIfUnique: if (comboBox.Items.Count == 1) { comboBox.SelectedIndex = 0; } else { comboBox.SelectedIndex = -1; } break; case SelectedItemOptions.Last: comboBox.SelectedIndex = comboBox.Items.Count - 1; break; default: break; } } else { comboBox.SelectedIndex = index; } }
public void test() { cbDB1.Items.Add(DBType.CubridDB + ""); cbDB2.Items.Add(DBType.OracleSQL + ""); cbDB2.Items.Add(DBType.MSSQL + ""); cbDB2.SelectedIndexChanged += defaultValues; if (!cb1.Checked) { tbPw1.PasswordChar = '*'; //MessageBox.Show("help"); } if (!cb2.Checked) { tbPw2.PasswordChar = '*'; } cbDB1.SelectedIndex = cbDB1.FindStringExact(DBType.CubridDB + ""); cbDB2.SelectedIndex = cbDB2.FindStringExact(DBType.OracleSQL + ""); }
public static void PopulateGroupsDropDown(ComboBox cb, string selected_text) { cb.Items.Clear(); dbGroups.Read(); foreach (Database.GroupDetails gd in dbGroups.ArrayListGroups) { cb.Items.Add(gd.GroupName); } cb.Items.Add("( Add new Group ) ..."); if (selected_text != string.Empty) { cb.SelectedIndex = cb.FindStringExact(selected_text); } }
private void LoadSettingsFromModel() { // if there is a report column specified and it appears in the column list, select it if (Model.ReportColumn.Length > 0 && cmbReport.FindStringExact(Model.ReportColumn) != -1) { cmbReport.SelectedItem = Model.ReportColumn; } else { cmbReport.SelectedItem = selectReportPrompt; } // if there is a category column specified and it appears in the column list, select it if (Model.CategoryColumn.Length > 0 && cmbCategory.FindStringExact(Model.CategoryColumn) != -1) { cmbCategory.SelectedItem = Model.CategoryColumn; } else { cmbCategory.SelectedItem = noCategory; } // if there is a measure column specified and it appears in the column list, select it if (Model.MeasureColumn.Length > 0 && cmbMeasure.FindStringExact(Model.MeasureColumn) != -1) { cmbMeasure.SelectedItem = Model.MeasureColumn; } else { cmbMeasure.SelectedItem = selectMeasurePrompt; } cmbStatistic.SelectedItem = Model.Statistic.ToString(); // top how many? nudN.Value = Model.N; // whether to include the chart chkIncludeChart.Checked = Model.IncludeChart; // custom title and footnote for the report txtTitle.Text = Model.Title; txtFootnote.Text = Model.Footnote; }
private void popCombo(System.Windows.Forms.ComboBox v3dC, List <View3D> views, FilteredElementCollector ViewC3D, Document doc, ElementId settings = null) { if (views != null) { v3dC.DataSource = views; v3dC.DisplayMember = "Name"; if (settings != null) { foreach (View3D item in ViewC3D) { if (item.Name == doc.GetElement(settings).Name) { v3dC.SelectedIndex = v3dC.FindStringExact(item.Name); } } } } }
private void popCombo(System.Windows.Forms.ComboBox Combo, List <Autodesk.Revit.DB.View> viewt, FilteredElementCollector ViewCEl, Document doc, ElementId settings = null) { if (viewt != null) { Combo.DataSource = viewt; Combo.DisplayMember = "Name"; if (settings != null) { foreach (Autodesk.Revit.DB.View item in ViewCEl) { if (item.Name == doc.GetElement(settings).Name) { Combo.SelectedIndex = Combo.FindStringExact(item.Name); } } } } }
private void popCombo(System.Windows.Forms.ComboBox vCombo, List <DimensionType> view, FilteredElementCollector ViewCollectSc, Document doc, ElementId settings = null) { if (view != null) { vCombo.DataSource = view; vCombo.DisplayMember = "Name"; if (settings != null) { foreach (DimensionType item in ViewCollectSc) { if (item.Name == doc.GetElement(settings).Name) { vCombo.SelectedIndex = vCombo.FindStringExact(item.Name); } } } } }
public static int UI_COMBO_SELECT(System.Windows.Forms.ComboBox control, string sItem, bool bZeroBase = true) { int nIndex; control.SelectedIndex = control.FindStringExact(sItem); nIndex = control.SelectedIndex; if (nIndex < 0 && bZeroBase) { nIndex = 0; } if (nIndex >= 0) { if (control.Items.Count > 0) { control.SelectedIndex = nIndex; } } return(nIndex); }
private void WzPageResourceSetup2_Load(object sender, System.EventArgs e) { //float dpiX, dpiY; //Graphics graphics = this.CreateGraphics(); //dpiX = graphics.DpiX; //dpiY = graphics.DpiY; //if (dpiX == dpiY) //{ // var 16heightEquivalent = picture //} //this.FunctoidIcon. string[] strFunctoidCategories = Enum.GetNames(typeof(FunctoidCategory)); try { if (_IsLoaded) { return; } foreach (string strFunctoidCategory in strFunctoidCategories) { cmbCategory.Items.Add(strFunctoidCategory); } cmbCategory.SelectedIndex = cmbCategory.FindStringExact("String"); AddWizardResult(WizardValues.FunctoidCategory, cmbCategory.SelectedItem.ToString()); _IsLoaded = true; } catch (Exception err) { MessageBox.Show(err.Message); Trace.WriteLine(err.Message + Environment.NewLine + err.StackTrace); } }
private void createCustomField(RedmineSettings.CustomFieldDefinition definition, int index) { //Window this.Size = new System.Drawing.Size(this.Size.Width, this.Size.Height + customFieldHeight); //New Issues this.issueDescription.Size = new System.Drawing.Size(this.issueDescription.Size.Width, this.issueDescription.Size.Height - customFieldHeight ); Label newIssueLabel = new System.Windows.Forms.Label(); newIssueLabel.AutoSize = true; newIssueLabel.Location = new System.Drawing.Point(8, currentCustomFieldPositionNewIssue); newIssueLabel.Size = new System.Drawing.Size(52, 13); newIssueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)))); newIssueLabel.Text = string.Concat(definition.name, ":"); this.tabPage1.Controls.Add(newIssueLabel); if (definition.fieldtype == RedmineSettings.CustomFieldDefinition.Fieldtype.FieldTypeList) { ComboBox newInputElement = new System.Windows.Forms.ComboBox(); newInputElement.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); newInputElement.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; newInputElement.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; newInputElement.FormattingEnabled = true; newInputElement.Location = new System.Drawing.Point(65, currentCustomFieldPositionNewIssue); newInputElement.Size = new System.Drawing.Size(479, 21); newInputElement.Items.AddRange(definition.values); if (!definition.defaultValue.Equals("")) { newInputElement.SelectedIndex = newInputElement.FindStringExact(definition.defaultValue); } this.tabPage1.Controls.Add(newInputElement); customFieldsNew[index] = newInputElement; } else { TextBox newInputElement = new System.Windows.Forms.TextBox(); newInputElement.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); newInputElement.Location = new System.Drawing.Point(65, currentCustomFieldPositionNewIssue); newInputElement.Size = new System.Drawing.Size(479, 20); newInputElement.Text = definition.defaultValue; this.tabPage1.Controls.Add(newInputElement); customFieldsNew[index] = newInputElement; } currentCustomFieldPositionNewIssue += customFieldHeight; //Update Issues this.issueNote.Size = new System.Drawing.Size(this.issueNote.Size.Width, this.issueNote.Size.Height - customFieldHeight ); Label updateIssueLabel = new System.Windows.Forms.Label(); updateIssueLabel.AutoSize = true; updateIssueLabel.Location = new System.Drawing.Point(8, currentCustomFieldPositionUpdateIssue); updateIssueLabel.Size = new System.Drawing.Size(52, 13); updateIssueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)))); updateIssueLabel.Text = string.Concat(definition.name, ":"); this.tabPage2.Controls.Add(updateIssueLabel); if (definition.fieldtype == RedmineSettings.CustomFieldDefinition.Fieldtype.FieldTypeList) { ComboBox updateInputElement = new System.Windows.Forms.ComboBox(); updateInputElement.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); updateInputElement.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; updateInputElement.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; updateInputElement.FormattingEnabled = true; updateInputElement.Location = new System.Drawing.Point(65, currentCustomFieldPositionUpdateIssue); updateInputElement.Size = new System.Drawing.Size(479, 21); updateInputElement.Items.AddRange(definition.values); this.tabPage2.Controls.Add(updateInputElement); customFieldsUpdate[index] = updateInputElement; } else { TextBox updateInputElement = new System.Windows.Forms.TextBox(); updateInputElement.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); updateInputElement.Location = new System.Drawing.Point(65, currentCustomFieldPositionUpdateIssue); updateInputElement.Size = new System.Drawing.Size(479, 20); this.tabPage2.Controls.Add(updateInputElement); customFieldsUpdate[index] = updateInputElement; } currentCustomFieldPositionUpdateIssue += customFieldHeight; /* this.issueNote = new System.Windows.Forms.TextBox(); // // issueNote // this.issueNote.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.issueNote.Location = new System.Drawing.Point(9, 238); this.issueNote.Multiline = true; this.issueNote.Name = "issueNote"; this.issueNote.Size = new System.Drawing.Size(526, 65); this.issueNote.TabIndex = 15; this.tabPage2.Controls.Add(this.issueNote); ;*/ }
private void TrySelectItem(ComboBox cbo, string value) { int i = cbo.FindStringExact(value); if (i >= 0) cbo.SelectedIndex = i; }
/// <include file='doc\WinBarComboBox.uex' path='docs/doc[@for="ToolStripComboBox.FindStringExact"]/*' /> public int FindStringExact(string s) { return(ComboBox.FindStringExact(s)); }
public void FindStringExact_StartIndex_ItemCount () { Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR"); ComboBox cmbbox = new ComboBox (); cmbbox.Items.AddRange (new object [] { "AB", "BA", "AB", "BA" }); #if NET_2_0 Assert.AreEqual (1, cmbbox.FindStringExact ("BA", 3)); #else try { cmbbox.FindString ("BA", 3); Assert.Fail ("#1"); } catch (ArgumentOutOfRangeException ex) { Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2"); Assert.IsNull (ex.InnerException, "#3"); Assert.IsNotNull (ex.Message, "#4"); Assert.IsNotNull (ex.ParamName, "#5"); Assert.AreEqual ("startIndex", ex.ParamName, "#6"); } #endif }
/// <summary> /// Autocomplete a combobox on keypress /// </summary> /// <param name="comboBox"></param> /// <param name="e"></param> public static void AutoCompleteOnKeyPress(ComboBox comboBox, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar)) return; string stringToFind = comboBox.Text.Substring(0, comboBox.SelectionStart) + e.KeyChar; int index = comboBox.FindStringExact(stringToFind); if (index == -1) index = comboBox.FindString(stringToFind); if (index == -1) return; comboBox.SelectedIndex = index; comboBox.SelectionStart = stringToFind.Length; comboBox.SelectionLength = comboBox.Text.Length - comboBox.SelectionStart; e.Handled = true; }
public void ListBoxItemDoubleClick(object sender, System.EventArgs e) { // Check the subitem clicked . if (this.SelectedItems.Count == 0) { return; } listSelectedRow = this.SelectedItems[0].Index; int nStart = X; int spos = 0; int epos = this.Columns[0].Width; for (int i = 0; i < this.Columns.Count; i++) { if (nStart > spos && nStart < epos) { subItemSelected = i; break; } spos = epos; if (i + 1 > Columns.Count - 1) { return; } epos += this.Columns[i + 1].Width; } string colName = this.Columns[subItemSelected].Text; if (colName == "Action") { //li.Checked = true; ComboBox cbAction = bActionInput ? ActionInputCmbBox : ActionCmbBox; cbAction.Location = new System.Drawing.Point(spos, li.Bounds.Y); cbAction.Size = new System.Drawing.Size(this.Columns[0].Width, li.Bounds.Bottom - li.Bounds.Top); cbAction.SelectedItem = this.SelectedItems[0].SubItems[0].Text; cbAction.Show(); //cmbBox.Text = subItemText; cbAction.SelectAll(); cbAction.Focus(); } else if (colName == "Duration") { if (this.SelectedItems[0].Text != "E-mail Event Activity") { DurationCmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y); DurationCmbBox.Size = new System.Drawing.Size(this.Columns[1].Width, li.Bounds.Bottom - li.Bounds.Top); DurationCmbBox.SelectedItem = this.SelectedItems[0].SubItems[1].Text; DurationCmbBox.Show(); //cmbBox.Text = subItemText; DurationCmbBox.SelectAll(); DurationCmbBox.Focus(); //if ((this.ItemChecked) && (this.SelectedItems >= 0)) //if (this.Items[this.SelectedItems.].Checked) //this.Items[this.SelectedItems].Checked = true; //else //this.Items[this.SelectedItems].Checked = false; } } else if (colName == "Reader ID") { ReaderCmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y); ReaderCmbBox.Size = new System.Drawing.Size(this.Columns[2].Width, li.Bounds.Bottom - li.Bounds.Top); ReaderCmbBox.SelectedIndex = ReaderCmbBox.FindStringExact(this.SelectedItems[0].SubItems[2].Text); Rectangle rect = GetColumnLocation(4); LocationLabel.Location = new System.Drawing.Point(rect.X, li.Bounds.Y); LocationLabel.Size = new System.Drawing.Size(this.Columns[4].Width, li.Bounds.Bottom - li.Bounds.Top - 1); ReaderCmbBox.Show(); //cmbBox.Text = subItemText; ReaderCmbBox.SelectAll(); ReaderCmbBox.Focus(); // LocationLabel.Show(); } else if (colName == "FGen ID") { FGenCmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y); FGenCmbBox.Size = new System.Drawing.Size(this.Columns[3].Width, li.Bounds.Bottom - li.Bounds.Top); FGenCmbBox.SelectedIndex = FGenCmbBox.FindStringExact(this.SelectedItems[0].SubItems[3].Text); Rectangle rect = GetColumnLocation(4); LocationLabel.Location = new System.Drawing.Point(rect.X, li.Bounds.Y); LocationLabel.Size = new System.Drawing.Size(this.Columns[4].Width, li.Bounds.Bottom - li.Bounds.Top - 1); FGenCmbBox.Show(); //cmbBox.Text = subItemText; FGenCmbBox.SelectAll(); FGenCmbBox.Focus(); // LocationLabel.Show(); } //else if (colName == "Location") //{ //LocationLabel.Location = new System.Drawing.Point(spos, li.Bounds.Y); //LocationLabel.Size = new System.Drawing.Size(this.Columns[4].Width, li.Bounds.Bottom - li.Bounds.Top); //LocationLabel.Show(); //} }
private void loadConfiguration(string configuration) { var d = new XmlDocument(); try { d.LoadXml(configuration); var foo = false; if (d.FirstChild.Attributes.GetNamedItem("useLog") != null) { bool.TryParse(d.FirstChild.Attributes["useLog"].InnerText, out foo); } chkUseLogFile.Checked = foo; _viewer.LogToFile = foo; if (d.FirstChild.Attributes.GetNamedItem("logFileName") != null) { txtLogFile.Text = d.FirstChild.Attributes["logFileName"].InnerText; _viewer.LogFile = d.FirstChild.Attributes["logFileName"].InnerText; } if (d.FirstChild.Attributes.GetNamedItem("logRoll") != null) { _viewer.LogRolling = d.FirstChild.Attributes["logRoll"].InnerText; var i = cboRolling.FindStringExact(_viewer.LogRolling); cboRolling.SelectedIndex = i; } if (d.FirstChild.Attributes.GetNamedItem("buffer") != null) { int intFoo; if (int.TryParse(d.FirstChild.Attributes["buffer"].InnerText, out intFoo)) { _viewer.BufferSize = intFoo; intFoo /= 1000; if (udBufferSize.Maximum >= intFoo && udBufferSize.Minimum <= intFoo) { udBufferSize.Value = intFoo; } else { if (udBufferSize.Maximum < intFoo) { udBufferSize.Value = udBufferSize.Maximum; } if (udBufferSize.Minimum > intFoo) { udBufferSize.Value = udBufferSize.Minimum; } } } else { _viewer.BufferSize = 1000000; } } foo = true; if (d.FirstChild.Attributes.GetNamedItem("cacheOnPause") != null) { bool.TryParse(d.FirstChild.Attributes["cacheOnPause"].InnerText, out foo); } chkCache.Checked = foo; _viewer.CacheOnPause = foo; txtExample.ForeColor = Color.FromName(d.FirstChild.Attributes["forecolor"].InnerText); cpForeColor.Text = d.FirstChild.Attributes["forecolor"].InnerText; _viewer.TextForeColor = txtExample.ForeColor; txtExample.BackColor = Color.FromName(d.FirstChild.Attributes["backcolor"].InnerText); cpBackColor.Text = d.FirstChild.Attributes["backcolor"].InnerText; _viewer.TextBackColor = txtExample.BackColor; var f = new Font(d.FirstChild.Attributes["font"].InnerText, Helpers.SafeFloatParse(d.FirstChild.Attributes["fontsize"].InnerText)); txtExample.Font = f; _viewer.TextFont = f; var actions = d.SelectNodes("//action"); foreach (XmlNode actionNode in actions) { _viewer.AddAction(Action.CreateGenericEventAction(actionNode)); } } catch (Exception ex) { _log.Error(GetHashCode(), ex.ToString(), ex); } }
private void UseItem(string Item, ComboBox ComboBox) { ComboBox.SelectedIndex = ComboBox.FindStringExact(Item); }
private void UpdataMainPropBindValue(ComboBox MModel, TextBox MPropRadius, TextBox MPropResolutin, int propagModelID, string radius, string resolution) { int num = this.m_TemplateTransceiverModule.TDTemplateCellModule.getPropModelMainID(); if (propagModelID == -1) { MModel.SelectedIndex = 0; MPropRadius.Text = "0"; MPropResolutin.Text = "0"; } else { MModel.SelectedIndex = MModel.FindStringExact(this.m_TemplateTransceiverModule.GetPropNameByID(propagModelID)); MPropRadius.Text = radius; if (MPropRadius.Text == string.Empty) { MPropRadius.Text = "0"; } MPropResolutin.Text = resolution; if (MPropResolutin.Text == string.Empty) { MPropResolutin.Text = "0"; } } }
//Добавление новой записи //Чтение из файла с выводом в конкретные поля public void ReadFromFileEDIT(int ID,TextBox textname, TextBox textname2, TextBox textname3, DateTimePicker date, TextBox phone, TextBox addinfo, ComboBox whois, PictureBox photo, TextBox adress, TextBox email, NumericUpDown dal, NumericUpDown vz9l) { OleDbConnection con = new OleDbConnection("provider=Microsoft.Jet.OleDb.4.0;Data Source=" + DBpath + ";Jet OLEDB:Database Password="******";"); OleDbCommand cmd = new OleDbCommand(); cmd.Connection = con; cmd.CommandText = "Select ID,Имя, Фамилия, Отчество, Дата_Рождения, Телефон, Адресс, Email, Кем_Является, Доп_Информация, Взял_В_Займы, Дал_В_Займы, Фото from People"; con.Open(); OleDbDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { int currentid = Convert.ToInt32(dr["ID"]); if (currentid == ID) { textname.Text = dr["Имя"].ToString(); textname2.Text = dr["Фамилия"].ToString(); textname3.Text = dr["Отчество"].ToString(); date.Value = Convert.ToDateTime(dr["Дата_Рождения"]); phone.Text = dr["Телефон"].ToString(); adress.Text = dr["Адресс"].ToString(); email.Text = dr["Email"].ToString(); whois.SelectedIndex = whois.FindStringExact(dr["Кем_Является"].ToString()); addinfo.Text = dr["Доп_Информация"].ToString(); vz9l.Value = Convert.ToDecimal(dr["Взял_В_Займы"]); dal.Value =Convert.ToDecimal(dr["Дал_В_Займы"]); photo.Image = null; if (dr["Фото"] != DBNull.Value) { photo_aray = (byte[])dr["Фото"]; MemoryStream ms = new MemoryStream(photo_aray); photo.Image = Image.FromStream(ms); } } } con.Close(); }
public void FindStringExact () { Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR"); ComboBox cmbbox = new ComboBox (); Assert.AreEqual (-1, cmbbox.FindStringExact ("Hello"), "#A1"); Assert.AreEqual (-1, cmbbox.FindStringExact (string.Empty), "#A2"); Assert.AreEqual (-1, cmbbox.FindStringExact (null), "#A3"); Assert.AreEqual (-1, cmbbox.FindStringExact ("Hola", -5), "#A4"); Assert.AreEqual (-1, cmbbox.FindStringExact ("Hola", 40), "#A5"); cmbbox.Items.AddRange (new object [] { "in", "BADTest", "IN", "BAD", "Bad", "In" }); Assert.AreEqual (2, cmbbox.FindStringExact ("IN"), "#B1"); Assert.AreEqual (0, cmbbox.FindStringExact ("in"), "#B2"); Assert.AreEqual (3, cmbbox.FindStringExact ("BAD"), "#B3"); Assert.AreEqual (3, cmbbox.FindStringExact ("bad"), "#B4"); Assert.AreEqual (-1, cmbbox.FindStringExact ("B"), "#B5"); Assert.AreEqual (-1, cmbbox.FindStringExact ("NonExistant"), "#B6"); Assert.AreEqual (-1, cmbbox.FindStringExact (string.Empty), "#B7"); Assert.AreEqual (-1, cmbbox.FindStringExact (null), "#B8"); Assert.AreEqual (2, cmbbox.FindStringExact ("In", 1), "#C1"); Assert.AreEqual (5, cmbbox.FindStringExact ("In", 2), "#C2"); Assert.AreEqual (4, cmbbox.FindStringExact ("BaD", 3), "#C3"); Assert.AreEqual (3, cmbbox.FindStringExact ("bad", -1), "#C4"); Assert.AreEqual (5, cmbbox.FindStringExact ("In", 4), "#C5"); Assert.AreEqual (3, cmbbox.FindStringExact ("bad", 4), "#C6"); Assert.AreEqual (-1, cmbbox.FindStringExact ("B", 4), "#C7"); Assert.AreEqual (-1, cmbbox.FindStringExact ("BADNOT", 0), "#C8"); Assert.AreEqual (-1, cmbbox.FindStringExact ("i", -1), "#C9"); Assert.AreEqual (-1, cmbbox.FindStringExact (string.Empty, 2), "#C10"); Assert.AreEqual (-1, cmbbox.FindStringExact (null, 1), "#C11"); cmbbox.Items.Add (string.Empty); Assert.AreEqual (6, cmbbox.FindStringExact (string.Empty), "#D1"); Assert.AreEqual (-1, cmbbox.FindStringExact (null), "#D2"); Assert.AreEqual (6, cmbbox.FindStringExact (string.Empty, 3), "#E1"); Assert.AreEqual (-1, cmbbox.FindStringExact (null, 99), "#E2"); Assert.AreEqual (-1, cmbbox.FindStringExact (null, -5), "#E3"); }
public static void InitialSelectCb(ComboBox cb, string Seleccion) { cb.SelectedIndex=cb.FindStringExact(Seleccion); }
public void FindStringExact_StartIndex_Max () { ComboBox cmbbox = new ComboBox (); cmbbox.Items.AddRange (new object [] { "ACBD", "ABDC", "ACBD", "ABCD" }); try { cmbbox.FindStringExact ("Hola", 4); Assert.Fail ("#1"); } catch (ArgumentOutOfRangeException ex) { Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2"); Assert.IsNull (ex.InnerException, "#3"); Assert.IsNotNull (ex.Message, "#4"); Assert.IsNotNull (ex.ParamName, "#5"); Assert.AreEqual ("startIndex", ex.ParamName, "#6"); } }
public void FindStringExact_StartIndex_ItemCount () { Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR"); ComboBox cmbbox = new ComboBox (); cmbbox.Items.AddRange (new object [] { "AB", "BA", "AB", "BA" }); Assert.AreEqual (1, cmbbox.FindStringExact ("BA", 3)); }
private static void SetDetails(ComboBox cbo, string details) { if (string.IsNullOrEmpty(details)) cbo.SelectedIndex = -1; else { int index = cbo.FindStringExact(details); if (index >= 0 || cbo.DropDownStyle == ComboBoxStyle.DropDownList) cbo.SelectedIndex = index; cbo.Text = details; } }
private void UpdataMainPropBindValue(ComboBox MModel, TextBox MPropRadius, TextBox MPropResolutin, int PropagModelId, string radius, string resolution) { if (PropagModelId == -1) { MModel.SelectedIndex = 0; MPropRadius.Text = "0"; MPropResolutin.Text = "0"; } else { MModel.SelectedIndex = MModel.FindStringExact(this.m_TplRelayModule.GetPropNameByID(PropagModelId)); MPropRadius.Text = radius; if (MPropRadius.Text == string.Empty) { MPropRadius.Text = "0"; } MPropResolutin.Text = resolution; if (MPropResolutin.Text == string.Empty) { MPropResolutin.Text = "0"; } } }
/// <include file='doc\WinBarComboBox.uex' path='docs/doc[@for="ToolStripComboBox.FindStringExact1"]/*' /> public int FindStringExact(string s, int startIndex) { return(ComboBox.FindStringExact(s, startIndex)); }
private void FillCombo(ComboBox c, object[] p) { string old = ""; if (c.SelectedIndex >= 0) old = c.Items[c.SelectedIndex].ToString(); c.Items.Clear(); c.Items.AddRange(p); if (old != "") c.SelectedIndex = c.FindStringExact(old); c.Enabled = true; }