-3
我想編寫寫入文件的代碼,但它說不能。我怎樣才能解決這個問題?請幫忙。我該如何編寫這段代碼而沒有錯誤
Imports System.IO
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
yes.Visible = False
no.Visible = False
Label1.Visible = False
ProgressBar1.Visible = False
Label2.Visible = False
Label3.Visible = False
TextBox1.Visible = False
TextBox2.Visible = False
apply.Visible = False
back.Visible = False
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Visible = False
yes.Visible = True
no.Visible = True
Label1.Visible = True
setings.Visible = False
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles yes.Click
Label1.Text = "dowloading"
no.Visible = False
yes.Visible = False
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles no.Click
yes.Visible = False
no.Visible = False
Label1.Visible = False
Button1.Visible = True
setings.Visible = True
End Sub
Private Sub setings_Click(sender As Object, e As EventArgs) Handles setings.Click
Label2.Visible = True
Label3.Visible = True
TextBox1.Visible = True
TextBox2.Visible = True
apply.Visible = True
back.Visible = True
Button1.Visible = False
setings.Visible = False
End Sub
Private Sub back_Click(sender As Object, e As EventArgs) Handles back.Click
Label2.Visible = False
Label3.Visible = False
TextBox1.Visible = False
TextBox2.Visible = False
apply.Visible = False
back.Visible = False
Button1.Visible = True
setings.Visible = True
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub apply_Click(sender As Object, e As EventArgs) Handles apply.Click
Dim forgepath = TextBox1.Text
Dim savefolder = Path.Combine(TextBox2.Text, "crazydolphininstaller")
Directory.CreateDirectory(savefolder)
Dim configfolder = Path.Combine(savefolder, "config")
Directory.CreateDirectory(configfolder)
Dim configfile = Path.Combine(configfolder, "config.txt")
File.Create(configfile)
Using writer = New StreamWriter(configfile)
writer.WriteLine(forgepath)
writer.WriteLine(savefolder)
End Using
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
End Sub
End Class
錯誤說的是什麼? – Webster
'「但它說它不能」' - 肯定有一個*更具體*表示的問題比。 「它不能」不是一個真正的標準錯誤信息。 – David
@David「它說」中的「它」並不清楚。 IDE?編譯器?運行時? –