write listbox to text file vb.net

The solution for “write listbox to text file vb.net” can be found here. The following code will assist you in solving the problem.

Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
If SaveFD.ShowDialog() = DialogResult.OK Then
Dim sb As New System.Text.StringBuilder()

For Each o As Object In ListBox1.Items

System.IO.File.WriteAllText(“c:\mypath\output.txt”, sb.ToString())
End If
End Sub

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts