你能帮我处理那个代码吗?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As String = "C:\Users\Andy\Documents\Visual Studio 2008\Projects\minecraft srv\"
For Each app As Process In Process.GetProcesses
If app.ProcessName = "notepad" Then
app.Kill()
End If
Next
Dim result As String
Dim servprop() As String
servprop = System.IO.Directory.GetFiles(x, "server.*")
For Each file In servprop
result = Path.GetFileName(file)
Next
Dim z As String = "C:\Users\Andy\Documents\Visual Studio 2008\Projects\minecraft srv\" & result.ToString
Dim t As StreamWriter = New StreamWriter(z)
t.WriteLine(TextBox1.Text.ToString)
t.Close()
End Sub
所以......我有一个按钮(button1),它会发现记事本是否打开并杀死它。然后,如果找到 server.properties,它会在“x”位置搜索“server.Properties”,然后“result”将获得他的名字(服务器)“z”是 streamwriter 必须从 textbox1 写入文本的文件位置。
而且它不起作用...... streamwirter 没有在 server.properties 上写入......为什么?提及:我只是一个孩子:D,我正在尝试自己学习视觉基础。