/// <summary> /// Combobox Automation, will execute on choosing one of the items in the dropdown menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cbxFieldsCount_SelectedValueChanged(object sender, EventArgs e) { int fieldsCount = (int)cbxFieldsCount.SelectedItem; MainFunction.GenerateCsvObject(fieldsCount); updateDataGridView(MainFunction._parsedCsv); }
/// <summary> /// Combobox Automation, will execute on entering a numeric value and press Enter /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cbxFieldsCount_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { int fieldsCount = 0; if (Int32.TryParse(cbxFieldsCount.Text, out fieldsCount)) { if (fieldsCount <= MainFunction._maxAllowedFields) { MainFunction.GenerateCsvObject(fieldsCount); updateDataGridView(MainFunction._parsedCsv); } else { MessageBox.Show("Please enter a lower field number", "Dupplicate column name"); } } } }