我無法調用從字符串 「的rlist」:我該如何回憶一個來自不同函數的字符串?
public void main()
{
string rlist;
if (radioButton1.Checked)
textBox1.Enabled = false;
textBox1.ReadOnly = true;
rlist = "text";
}
到
public void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFile = new OpenFileDialog();
openFile.Filter = "WTF Files (*.wtf)|*.wtf";
openFile.Title = "Please Pick your realmlist file:";
if (openFile.ShowDialog() == DialogResult.Cancel)
return;
try
{
textBox5.Text = openFile.FileName;
string file = openFile.FileName;
TextWriter rlist_writer = new StreamWriter (openFile.FileName);
rlist_writer.WriteLine(rlist);
rlist_writer.Close();
}
catch (Exception)
{
MessageBox.Show("Error opening file", "File Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
我就在這行錯誤:
rlist_writer.WriteLine(rlist);
是它可以調用字符串從一個函數發送到另一個具有相同的值,它在它最初被拉出的函數?
好的,謝謝。我會嘗試這個,看看會發生什麼:)我一直試圖找出這2天。 – user2333783 2013-04-29 22:01:39
不用擔心,如果您覺得這是您的問題的正確答案,請考慮接受爲您選擇的答案 – Sayse 2013-04-29 22:20:35