0
我试图列出一些东西,人们可以放在那里就像购物清单,但我的程序无法访问C:\驱动器,所以我决定把它放到资源文件夹中,但是那没有工作的人有任何想法如何让工作/ ??vb.net读取和写入文本文件里面的资源
我的代码:
Private Sub ThirteenButton14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ThirteenButton14.Click
ListBox1.Items.Remove(ListBox1.SelectedItem)
Dim i As Integer
w = New IO.StreamWriter(My.Resources.FavoriteList)
For i = 0 To ListBox1.Items.Count - 1
w.WriteLine(ListBox1.Items.Item(i))
Next
w.Close()
ListBox1.Items.Clear()
R = New IO.StreamReader(My.Resources.FavoriteList)
While (R.Peek() > -1)
ListBox1.Items.Add(R.ReadLine)
End While
R.Close()
End Sub
Private Sub ThirteenButton13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ThirteenButton13.Click
ListBox1.Items.Add(ThirteenTextBox6.Text + " | " + ThirteenTextBox7.Text)
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
Dim i As Integer
w = New IO.StreamWriter(My.Resources.FavoriteList)
For i = 0 To ListBox1.Items.Count - 1
w.WriteLine(ListBox1.Items.Item(i))
Next
w.Close()
ListBox1.Items.Clear()
R = New IO.StreamReader(My.Resources.FavoriteList)
While (R.Peek() > -1)
ListBox1.Items.Add(R.ReadLine)
End While
R.Close()
End Sub
这对我来说没有工作。 任何帮助都是合适的y =谢谢
你曾说过两次“没有工作”,但你没有说出“没有工作”的含义。它以什么方式不起作用?你清楚地知道什么是行不通的,因为你在这里张贴并说了这样的话。为什么不在我们的帖子中分享这些信息?我们无法看到您的屏幕或阅读您的想法。如果您希望我们帮助您,*请提供您已拥有的信息*,以便于您做到这一点。如果出现错误,请包含**确切的错误消息*。如果某些东西不起作用,请以何种方式解释不起作用。 –