0

I am useing the OpenFileDialog component with a Button Sub to use the text file that the user selects (it can change everyday) in the next part of my program that will read that file and then covert it into an xml format. How do I get the second part of my program to use the file selected?

Private Sub Button1_Click(ByVal sender As System.Object, _
   ByVal e As System.EventArgs) Handles Button1.Click
   If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
     Dim sr As New System.IO.StreamReader(OpenFileDialog1.FileName)
     MessageBox.Show(sr.ReadToEnd)
     sr.Close()
   End If
End Sub

thanks.

Edited by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by wasyazwan
0

I am useing the OpenFileDialog component with a Button Sub to use the text file that the user selects (it can change everyday) in the next part of my program that will read that file and then covert it into an xml format. How do I get the second part of my program to use the file selected?

Private Sub Button1_Click(ByVal sender As System.Object, _
   ByVal e As System.EventArgs) Handles Button1.Click
   If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
     Dim sr As New System.IO.StreamReader(OpenFileDialog1.FileName)
     MessageBox.Show(sr.ReadToEnd)
     sr.Close()
   End If
End Sub

thanks.

Thanks for the help. This solved my problem

Edited by mike_2000_17: Fixed formatting

0

could you post your complete code to use FileOK... sorry... im newbie in vb.net

Edited by wasyazwan: wrong thread reply

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.