我打了一個包版,試圖爲我的文本框創建一個AutoCompletion。閱讀.txt的子字符串,爲AutoCompleteSource返回子字符串
嘗試#1
string[] fileDB = Account.filedbContents;
string[] lines = { };
using (StreamReader sr = new StreamReader(@FILE_PATH)
while ((textboxWebsite.Text = sr.ReadLine()) != null)
{
lines.Add(sr.ReadLine());
}
嘗試#2
textboxWebsite.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
textboxWebsite.AutoCompleteSource = AutoCompleteSource.CustomSource;
var autoComplete = new AutoCompleteStringCollection();
autoComplete.AddRange()
string[] substrings = new string[] { textboxWebsite.Text };
substrings.SelectMany(substring => Enumerable.Range(0,))
string line = File.Read(@"C:\Users\snogueir\Desktop\Coding\sandbox\keychainarray.txt");
}
AutoCompleteStringCollection collection = new AutoCompleteStringCollection();
collection.AddRange(arr);
this.textboxWebsite.AutoCompleteCustomSource = collection;
頭是有點炸。我試圖在用戶輸入一個文本框的時候創建一個AutoCompletion,它會嘗試在 .txt文件中找到最相似的網站的現有條目(想象一下,在文本框中輸入'face',會如果存在,建議'臉書')
website1=username1=password1
website2=username2=password2
website3=username3=password3
這些都沒有編譯。
我正在考慮使用String.Split('='),但我能想到的唯一方法是通過創建一個單獨的數組用於每行,然後返回credentialarray [0](因爲這將是網站)。
幫助!
什麼是編譯錯誤? – Atlasmaybe