本文整理汇总了C#中System.Windows.Forms.AutoCompleteStringCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# AutoCompleteStringCollection.Add方法的具体用法?C# AutoCompleteStringCollection.Add怎么用?C# AutoCompleteStringCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.AutoCompleteStringCollection
的用法示例。
在下文中一共展示了AutoCompleteStringCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
if (Directory.Exists(GetCheetahFolder()) == false)
Directory.CreateDirectory(GetCheetahFolder());
WebConfig conf = WebConfig.Default;
#if DEBUG
conf.LogFile = Application.StartupPath + @"\log.txt";
conf.LogSeverity = ChromiumEngine.Enum.LogSeverity.Verbose;
#endif
if (Directory.Exists(GetCheetahFolder() + @"\Cache\") == false)
Directory.CreateDirectory(GetCheetahFolder() + @"\Cache\");
conf.CachePath = GetCheetahFolder() + @"\Cache\";
WebCore.Initialize(conf);
History.initialize();
Bookmarking.initialize();
autocompletedata = new AutoCompleteStringCollection();
for (int i = 0; i < History.GetItemsCount() - 1; i++)
autocompletedata.Add(History.Url(i));
for (int i = 0; i < Bookmarking.GetItemsCount() - 1; i++)
autocompletedata.Add(Bookmarking.Url(i));
AuthenticationPasswords.Initialize();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(true);
Application.Run(new Form1());
WebCore.ShutDown();
}
示例2: 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);
}
示例3: AutoComplete_Init
//Initialization for AutoComplete
public void AutoComplete_Init(TextBox tbx, string filename)
{
filename = path + filename;
//Instantiation for AutoComplete
AutoCompleteStringCollection auto_scs = new AutoCompleteStringCollection();
tbx.AutoCompleteCustomSource = auto_scs;
string directory = Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\SCV";
//Checking of LOCALAPPDATA <C:\Users\AppData\Local> directory and file
if (Directory.Exists(directory) == false)
{
DirectoryInfo di = Directory.CreateDirectory(directory);
}
if (File.Exists(filename) == false)
{
FileStream fs = File.Create(filename);
fs.Close();
this.file_flg = true;
}
//Reading file for AutoComplete
foreach (string row in File.ReadLines(filename, SJIS))
{
if(row.Contains(","))
{
string[] data = row.Split(',');
auto_scs.Add(data[0]);
}
else
{
auto_scs.Add(row);
}
}
//Auto Input from last history
//Getting file size
System.IO.FileInfo fi = new System.IO.FileInfo(filename);
long filesize = fi.Length;
//File is not null(or brank)
if (filesize != 0)
{
//Reading all row from file
string[] lines = System.IO.File.ReadAllLines(filename);
//Input for history from last data
if (tbx.Name == "tbxUser")
{
string[] data = (lines[lines.Length - 1]).Split(',');
tbx.Text = data[0];
}
else
{
string data = lines[lines.Length - 1];
tbx.Text = data;
}
}
}
示例4: 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;
}
示例5: 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();
}
示例6: 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;
}
}
示例7: frmContacts
public frmContacts()
{
InitializeComponent();
Icon = Properties.Resources.logo;
DataSet ds = Program.DB.SelectAll("SELECT ID,Name FROM Companies;");
if (ds.Tables.Count > 0)
{
AutoCompleteStringCollection asCompanies = new AutoCompleteStringCollection();
foreach (DataRow r in ds.Tables[0].Rows)
{
string sName = r["Name"].ToString();
asCompanies.Add(sName);
}
txtCompanies.AutoCompleteCustomSource = asCompanies;
}
ds = Program.DB.SelectAll("SELECT ID,NameFirst,NameLast FROM Contacts;");
if (ds.Tables.Count > 0)
{
foreach (DataRow r in ds.Tables[0].Rows)
{
DevComponents.Editors.ComboItem i = new DevComponents.Editors.ComboItem();
i.Tag = r["ID"];
i.Text = r["NameFirst"].ToString() + " " + r["NameLast"].ToString();
cbxContact.Items.Add(i);
}
}
}
示例8: addCarnets
private void addCarnets(AutoCompleteStringCollection DataCollection)
{
foreach (Alumnos Alumno in Alumnos)
{
DataCollection.Add(Alumno.carnet + " - " + Alumno.nombres );
}
}
示例9: 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);
}
}
示例10: 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;
}
示例11: 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]));
}
}
示例12: Autocomplete
private void Autocomplete()
{
try
{
con = new OleDbConnection(cs);
con.Open();
OleDbCommand cmd = new OleDbCommand("SELECT distinct Categoryname FROM Category", con);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds, "Category");
AutoCompleteStringCollection col = new AutoCompleteStringCollection();
int i = 0;
for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
col.Add(ds.Tables[0].Rows[i]["Categoryname"].ToString());
}
txtCategoryName.AutoCompleteSource = AutoCompleteSource.CustomSource;
txtCategoryName.AutoCompleteCustomSource = col;
txtCategoryName.AutoCompleteMode = AutoCompleteMode.Suggest;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例13: searchJobCategory
// Search department
public void searchJobCategory()
{
searchJobCategoryName.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
searchJobCategoryName.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection collection = new AutoCompleteStringCollection();
sqlConnection = new MySqlConnection(databaseConnection);
try
{
sqlConnection.Open();
MySqlCommand sqlCommand = new MySqlCommand("SELECT * FROM job_category", sqlConnection);
MySqlDataReader reader = sqlCommand.ExecuteReader();
while (reader.Read())
{
String name = reader.GetString("name");
collection.Add(name);
}
}
catch (Exception exception)
{
MessageBox.Show("Error has occured while seraching department, : " + exception.Message);
}
searchJobCategoryName.AutoCompleteCustomSource = collection;
}
示例14: frmArticulosBorradoMasivo
public frmArticulosBorradoMasivo()
{
InitializeComponent();
System.Drawing.Icon ico = Properties.Resources.icono_app;
this.Icon = ico;
this.Text = " Borrado de artículos sin stock";
this.ControlBox = true;
this.MaximizeBox = false;
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
cmbGenero.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox);
cmbGenero.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
DataTable tblGeneros = BL.GetDataBLL.Generos();
cmbGenero.ValueMember = "IdGeneroGEN";
cmbGenero.DisplayMember = "DescripcionGEN";
cmbGenero.DropDownStyle = ComboBoxStyle.DropDown;
cmbGenero.DataSource = tblGeneros;
cmbGenero.SelectedValue = -1;
AutoCompleteStringCollection generosColection = new AutoCompleteStringCollection();
foreach (DataRow row in tblGeneros.Rows)
{
generosColection.Add(Convert.ToString(row["DescripcionGEN"]));
}
cmbGenero.AutoCompleteCustomSource = generosColection;
cmbGenero.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cmbGenero.AutoCompleteSource = AutoCompleteSource.CustomSource;
}
示例15: frmDodjelaPrava_Load
private void frmDodjelaPrava_Load(object sender, EventArgs e)
{
// key/value for combobox source
List<KeyValuePair<string, string>> data = new List<KeyValuePair<string, string>>();
// autocomplete for user's combobox
AutoCompleteStringCollection autocomplete = new AutoCompleteStringCollection();
// text inside combobox: Name Surname (username)
// value: username
foreach (iUser korisnik in piLogin.GetUser())
{
data.Add(new KeyValuePair<string, string> (korisnik.UserName, korisnik.Name + " " + korisnik.Surname + " (" + korisnik.UserName + ")"));
autocomplete.Add(korisnik.Name + " " + korisnik.Surname + " (" + korisnik.UserName + ")");
}
// set datasource for user's combobox
cmbKorisnik.DataSource = new BindingSource(data, null);
cmbKorisnik.DisplayMember = "Value";
cmbKorisnik.ValueMember = "Key";
// set autocomplete source and mode
cmbKorisnik.AutoCompleteSource = AutoCompleteSource.CustomSource;
cmbKorisnik.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cmbKorisnik.AutoCompleteCustomSource = autocomplete;
// set role items
cmbUloga.Items.Add("Odobravanje");
cmbUloga.Items.Add("Likvidatura");
// if user is set, select it from combobox
if (this.korisnik != null)
{
cmbKorisnik.SelectedValue = this.korisnik.UserName;
}
}