到目前为止,如果用户输入某些内容,我会将其存储在标签属性中。我知道这不可能。如何根据用户输入更新变量,以便在需要使用它的任何事件中使用?
这是我尝试过的许多事情之一。我什至无法找出正确的搜索词来搜索我需要做的解决方案。
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;
}
}