本文整理汇总了C#中System.Windows.Forms.AutoCompleteStringCollection类的典型用法代码示例。如果您正苦于以下问题:C# AutoCompleteStringCollection类的具体用法?C# AutoCompleteStringCollection怎么用?C# AutoCompleteStringCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutoCompleteStringCollection类属于System.Windows.Forms命名空间,在下文中一共展示了AutoCompleteStringCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: autoComplete
public AutoCompleteStringCollection autoComplete()
{
AutoCompleteStringCollection collection = new AutoCompleteStringCollection();
try
{
SqlConnectionObj.Open();
string query = "select * from tbl_room";
SqlCommandObj.CommandText = query;
SqlDataReader reader = SqlCommandObj.ExecuteReader();
while (reader.Read())
{
string roomNo = reader["roomNo"].ToString();
collection.Add(roomNo);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if (SqlConnectionObj != null && SqlConnectionObj.State == ConnectionState.Open)
{
SqlConnectionObj.Close();
}
}
return collection;
}
示例2: EDDiscoveryForm
public EDDiscoveryForm()
{
InitializeComponent();
EDDConfig = new EDDConfig();
//_fileTgcSystems = Path.Combine(Tools.GetAppDataDirectory(), "tgcsystems.json");
_fileEDSMDistances = Path.Combine(Tools.GetAppDataDirectory(), "EDSMDistances.json");
string logpath="";
try
{
logpath = Path.Combine(Tools.GetAppDataDirectory(), "Log");
if (!Directory.Exists(logpath))
{
Directory.CreateDirectory(logpath);
}
}
catch (Exception ex)
{
Trace.WriteLine($"Unable to create the folder '{logpath}'");
Trace.WriteLine($"Exception: {ex.Message}");
}
_edsmSync = new EDSMSync(this);
trilaterationControl.InitControl(this);
travelHistoryControl1.InitControl(this);
imageHandler1.InitControl(this);
SystemNames = new AutoCompleteStringCollection();
Map = new EDDiscovery2._3DMap.MapManager();
}
示例3: Reload
/// <summary>Reloads the repo's objects tree.</summary>
public void Reload()
{
// todo: task exception handling
Cancel();
_cancelledTokenSource = new CancellationTokenSource();
var token = _cancelledTokenSource.Token;
var tasks = rootNodes.Select(r => r.ReloadTask(token)).ToArray();
Task.Factory.ContinueWhenAll(tasks,
(t) =>
{
if (!t.All(r => r.Status == TaskStatus.RanToCompletion))
{
return;
}
if (token.IsCancellationRequested)
{
return;
}
BeginInvoke(new Action(() =>
{
var autoCompletionSrc = new AutoCompleteStringCollection();
autoCompletionSrc.AddRange(
_branchFilterAutoCompletionSrc.ToArray());
txtBranchFilter.AutoCompleteCustomSource = autoCompletionSrc;
}));
}, _cancelledTokenSource.Token);
tasks.ToList().ForEach(t => t.Start());
}
示例4: initGui
public void initGui()
{
clg = new dataHandler.catalog(timeout: gpExtension.timeout);
keyWords = new AutoCompleteStringCollection();
keyWords.AddRange( clg.getKeyWords().ToArray() );
keywordTxt.AutoCompleteSource = AutoCompleteSource.CustomSource;
keywordTxt.AutoCompleteCustomSource = keyWords;
gdiThemes = clg.getGDIthemes();
gdiThemes.Insert(0, "");
GDIthemeCbx.DataSource = gdiThemes;
orgNames = clg.getOrganisations();
orgNames.Insert(0, "");
orgNameCbx.DataSource = orgNames;
dataBronnen = clg.getSources();
List<string> bronnen = dataBronnen.Select(c => c.Key).ToList();
bronnen.Insert(0, "");
bronCatCbx.DataSource = bronnen;
dataTypes = clg.dataTypes;
List<string> dtypes = dataTypes.Select(c => c.Key).ToList();
dtypes.Insert(0, "");
typeCbx.DataSource = dtypes;
inspKeyw = clg.inspireKeywords();
inspKeyw.Insert(0, "");
INSPIREthemeCbx.DataSource = inspKeyw;
INSPIREannexCbx.DataSource = clg.inpireAnnex;
INSPIREserviceCbx.DataSource = clg.inspireServiceTypes;
filterResultsCbx.SelectedIndex = 0;
}
示例5: EnableFaytAndDropDownList
public static void EnableFaytAndDropDownList(ComboBox comboBox, AutoCompleteStringCollection dataSource)
{
comboBox.AutoCompleteCustomSource = dataSource;
comboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
comboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
comboBox.DataSource = new BindingSource(dataSource, null); //HACK: Stop combo boxes from staying in sync with one another
}
示例6: MainWindow
public MainWindow()
{
InitializeComponent();
using (var db = new MySqlContext())
{
var permissions = from a in db.Permissions
select a.Name;
this.checkedListBox_permissions.Items.AddRange(permissions.ToArray());
this.checkedListBox_modificar_permissions.Items.AddRange(permissions.ToArray());
var users = from b in db.LoginModels
select b.User;
this.checkedListBox_users.Items.AddRange(users.ToArray());
this.checkedListBox_modificar_users.Items.AddRange(users.ToArray());
var roles = from r in db.Roles
select r.Name;
AutoCompleteStringCollection accl = new AutoCompleteStringCollection();
accl.AddRange(roles.ToArray());
txt_rol_nombre.AutoCompleteMode = AutoCompleteMode.Suggest;
txt_rol_nombre.AutoCompleteCustomSource = accl;
txt_rol_nombre.AutoCompleteSource = AutoCompleteSource.CustomSource;
txt_modificar_nombre.AutoCompleteMode = AutoCompleteMode.Suggest;
txt_modificar_nombre.AutoCompleteCustomSource = accl;
txt_modificar_nombre.AutoCompleteSource = AutoCompleteSource.CustomSource;
}
}
示例7: AutoComplete_Init
//オートコンプリートの初期化
public void AutoComplete_Init(TextBox tbx, string filename)
{
//オートコンプリート用インスタンス生成
AutoCompleteStringCollection auto_scs = new AutoCompleteStringCollection();
tbx.AutoCompleteCustomSource = auto_scs;
string directory = Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\SCV";
//iniファイル用ディレクトリの確認
if (Directory.Exists(directory) == false)
{
DirectoryInfo di = Directory.CreateDirectory(directory);
}
//保存用 ini ファイルの読込/作成
if (File.Exists(filename) == false)
{
FileStream fs = File.Create(filename);
fs.Close();
}
//読み込んだファイル内容の反映
foreach (string row in File.ReadLines(filename, SJIS))
{
auto_scs.Add(row);
}
}
示例8: AutoComplete_Init
//オートコンプリートの初期化
public void AutoComplete_Init(TextBox tbx, string filename)
{
//オートコンプリート用インスタンス生成
AutoCompleteStringCollection auto_scs = new AutoCompleteStringCollection();
tbx.AutoCompleteCustomSource = auto_scs;
string directory = Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\SCV";
//保存用 ini ファイルの読込/作成
if (File.Exists(filename) == false)
{
FileStream fs = File.Create(filename);
fs.Close();
}
//読み込んだファイル内容をパスワードを復号化し反映
foreach (string row in File.ReadLines(filename, SJIS))
{
auto_scs.Add(Decrypt(row));
}
//ファイルのサイズを取得
System.IO.FileInfo fi = new System.IO.FileInfo(filename);
long filesize = fi.Length;
//ファイルの中身が空ではない場合、テキストボックスに初期値を追記
if (filesize != 0)
{
//テキストファイルからすべての行を読み込む
string[] lines = System.IO.File.ReadAllLines(filename);
//最終行の値を追記
tbx.Text = (Decrypt(lines[lines.Length - 1]));
}
}
示例9: FillTheCustomerInfo
public void FillTheCustomerInfo(custVendor.CustVendorManager.custvendorinfo custInfo)
{
AutoCompleteStringCollection contactSource = new AutoCompleteStringCollection();
if (custInfo.contact1.Length!=0)
{
tbContact.Text = custInfo.contact1;
contactSource.Add(custInfo.contact1);
}
if (custInfo.contact2.Length!=0)
{
contactSource.Add(custInfo.contact2);
}
tbContact.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
tbContact.AutoCompleteSource = AutoCompleteSource.CustomSource;
tbContact.AutoCompleteCustomSource = contactSource;
tbCustomerAccount.Text = custInfo.cvnumber;
tbFreightTerm.Text = custInfo.shippingTerm;
tbPaymentTerm.Text = custInfo.paymentTerm;
tbBillto.Text = custInfo.billTo;
List<custVendor.CustVendorManager.custvendorinfoshipto> shipToList = custVendor.CustVendorManager.CustVenInfoManager.GetShipTo(custInfo.cvId);
List<string> shipToListString = new List<string>();
foreach (custVendor.CustVendorManager.custvendorinfoshipto shipto in shipToList)
{
shipToListString.Add(shipto.shipTo);
}
SetShipToList(shipToListString);
}
示例10: searchDepartmentalHeads
// Search departmental heads
public void searchDepartmentalHeads()
{
searchDepartmentalHeadStaffIdTextBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
searchDepartmentalHeadStaffIdTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection collection = new AutoCompleteStringCollection();
sqlConnection = new MySqlConnection(databaseConnection);
try
{
sqlConnection.Open();
MySqlCommand sqlCommand = new MySqlCommand("SELECT * FROM departmental_heads", sqlConnection);
MySqlDataReader reader = sqlCommand.ExecuteReader();
while (reader.Read())
{
String name = reader.GetInt64("pfno").ToString();
collection.Add(name);
}
}
catch (Exception exception)
{
MessageBox.Show("Error has occured while seraching departmental head, : " + exception.Message);
}
searchDepartmentalHeadStaffIdTextBox.AutoCompleteCustomSource = collection;
}
示例11: SetupElements
private void SetupElements(NationSelectForm nationSelectForm, Nation selectedNation, int numberOfCrewSlots)
{
_nationSelectForm = nationSelectForm;
_selectedNation = selectedNation;
_numberOfCrewSlots = numberOfCrewSlots;
_vehicleType = new VehicleType(); // Crappy default value
_crewSlotData = Helpers.LoadCrewSlotDataFromFile(CrewSlotDataFileName) ?? new List<CrewSlotData>(); // Load from file, if null is returned, creates a new (empty) list
if (_crewSlotData.Count < 1) // Happens only when nothing comes from reading the file with data.
{
_crewSlotData.Add(new CrewSlotData(_selectedNation));
}
#region Setup fields for form controls
List<string> vehicleNames = Helpers.LoadVehicleDataFromJson(Helpers.GetVehicleJsonDataForNation(_selectedNation)).OrderBy(v => v.VehicleName).Select(v => v.VehicleName).ToList();
_faytVehicleSource = new AutoCompleteStringCollection();
_faytVehicleSource.AddRange(vehicleNames.ToArray());
List<string> vehicleTypes = Helpers.LoadVehicleTypesDataFromJson(Helpers.GetVehicleTypesJsonData()).OrderBy(t => t.VehicleTypeLongName).Select(t => t.VehicleTypeLongName).ToList();
_faytVehicleTypeSource = new AutoCompleteStringCollection();
_faytVehicleTypeSource.AddRange(vehicleTypes.ToArray());
_crewSlotConfigurations = new List<CrewSlotConfiguration>();
_crewSlotGroupBoxes = new Dictionary<int, GroupBox>();
_crewNameComboBoxes = new Dictionary<int, ComboBox>();
_crewTrainedMembersNumericScrollers = new Dictionary<int, NumericUpDown>();
_crewVehicleTypeComboBoxes = new Dictionary<int, ComboBox>();
#endregion
SetFormHeight();
Helpers.ChangeBackground(this, selectedNation);
PopulateFormControls();
}
示例12: AutoCompleteAnimalSerial
private void AutoCompleteAnimalSerial()
{
//auto completes Employee name in check out page.
textBoxTreatmentSerial.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
textBoxTreatmentSerial.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection collection1 = new AutoCompleteStringCollection();
textBoxFoodAnimalSerial.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
textBoxFoodAnimalSerial.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection collection2 = new AutoCompleteStringCollection();
SqlConnection connection = new SqlConnection(connectionString);
string commandString = "SELECT aserial FROM animal";
SqlCommand command = new SqlCommand(commandString, connection);
SqlDataReader myReader;
try
{
connection.Open();
myReader = command.ExecuteReader();
while (myReader.Read())
{
string value = myReader["aserial"].ToString();
collection1.Add(value);
collection2.Add(value);
}
connection.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
textBoxTreatmentSerial.AutoCompleteCustomSource = collection1;
textBoxFoodAnimalSerial.AutoCompleteCustomSource = collection2;
NameShadeShow();
}
示例13: FindObjectForm_Shown
/// <summary>The find object form_ shown.</summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
private void FindObjectForm_Shown(object sender, EventArgs e)
{
var collection = new AutoCompleteStringCollection();
try
{
UseWaitCursor = true;
if (_databaseInspector.DbSchema == null)
{
_databaseInspector.LoadDatabaseDetails();
}
foreach (DbModelTable table in _databaseInspector.DbSchema.Tables)
{
collection.Add(table.FullName);
}
foreach (DbModelView view in _databaseInspector.DbSchema.Views)
{
collection.Add(view.FullName);
}
}
finally
{
UseWaitCursor = false;
}
cboObjects.AutoCompleteCustomSource = collection;
}
示例14: Initialize
public void Initialize()
{
SetFormHeader();
AutoCompleteStringCollection cmbstrName = new AutoCompleteStringCollection();
AutoCompleteStringCollection cmbstrJer = new AutoCompleteStringCollection();
DataRow drTeam = ObjUdtprovider.CurrentDataSet.Tables[2].Select("Name = '" + Team+"'").FirstOrDefault();
if (drTeam != null)
{
DataRow[] drPlayers = ObjUdtprovider.CurrentDataSet.Tables[3].Select("T24_ID = '" + drTeam["T24_ID"] + "' AND Playing=true");
cmbPlayerJer.Items.Clear();
cmbPlayerName.Items.Clear();
foreach (DataRow item in drPlayers)
{
cmbPlayerName.Items.Add(item["First Name"]);
cmbstrName.Add(item["First Name"].ToString());
cmbPlayerJer.Items.Add(item["Jersey No"]);
cmbstrJer.Add(item["Jersey No"].ToString());
}
cmbPlayerName.SelectedIndex = 1;
cmbPlayerJer.SelectedIndex = 1;
cmbPlayerName.AutoCompleteMode = AutoCompleteMode.Suggest;
cmbPlayerName.AutoCompleteSource = AutoCompleteSource.CustomSource;
cmbPlayerName.AutoCompleteCustomSource = cmbstrName;
cmbPlayerJer.AutoCompleteMode = AutoCompleteMode.Suggest;
cmbPlayerJer.AutoCompleteSource = AutoCompleteSource.CustomSource;
cmbPlayerJer.AutoCompleteCustomSource = cmbstrJer;
}
}
示例15: textBox1_TextChanged_1
private void textBox1_TextChanged_1(object sender, EventArgs e)
{
AutoCompleteStringCollection names = new AutoCompleteStringCollection();
textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
string server = "MYSQL5009.HostBuddy.com";
string database = "db_9cf135_hawk";
string uid = "9cf135_hawk";
string password = "ticcttmosfet";
string connectionString;
connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";
MySqlConnection con = new MySqlConnection(connectionString);
con.Open();
MySqlCommand cms = new MySqlCommand("select * from user", con);
MySqlDataReader dr = cms.ExecuteReader();
while (dr.Read())
{
names.Add(dr[1].ToString());
}
dr.Close();
con.Close();
textBox1.AutoCompleteCustomSource = names;
}