簡體   English   中英

check.txt 文件內容是否與文本框中的文本匹配 c#

[英]check .txt file content if it match the text in the text box c#

嗨,我需要驗證一個文本框輸入 throw a.dat file[plain text] 如果它匹配它做其他事情,如果不是我顯示一個彈出消息,任何幫助將不勝感激,如果你也可以告訴我如何加密that.dat 文件更安全
謝謝

嘗試這樣的事情:

// read file content into a string
String fileContent = System.IO.File.ReadAllText(@"c:\file.dat");

// compare TextBox content with file content
if (fileContent.Equals(myTextBox.Text))
{
    // do something
}
else
{
    MessageBox.Show("Error!");
}

看看StreamReader ,它將允許您將文件讀入您的應用程序。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM