到目前爲止,如果用戶輸入內容,我將存儲在標籤屬性中。我知道這是不對的。我如何根據用戶輸入更新變量,以便在需要使用它的任何事件中使用?將用戶輸入保存爲c#windows窗體中的變量
這是我嘗試過的很多事情之一。我甚至無法找出正確的搜索條件來搜索我需要做的解決方案。
namespace Words
{
public partial class formWords : Form
{
int x = 5;
int y = 50;
int buttonWidth = 120;
int buttonHeight = 40;
string fileList = "";
string word = "";
string wordFolderPath = @"C:\words\";// this is the variable I want to change with the dialog box below.
private void selectWordFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
FolderBrowserDialog folder = new FolderBrowserDialog();
if (folder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string folderPath = folder.SelectedPath;
formWords.wordFolderPath = folderPath;
}
}
我認爲這比以前複雜得多。謝謝。 –