Saturday, December 8, 2007

VB.Net IO Code .

This Is small Tip For File.io Staff :
Create a new vb.net project.
add a button rename it to btnBrowse , OpenDialogeBox Rename it dlgOpenFile ,and TextBox Rename it txtFilePAth.
Double click the button and add this code:
Dim dlgOpenFile as new openFileDialog
dlgOpenFile.IntialDirectory="C:\"
dlgOpenFile.Filter="text files (*.txt)|*.txt"
if dlgOpenFile.showdialog=windows.forms.dialogResult.ok then
me.txtFilePAth.text=dlgOpenFile.filename
me.txtFileDate.text= me.readfile(dlgOpenFile.fileName)
End IF
--------
Add this code for Function ReadFile()
Private Function ReadFile(byval strFilePAth as string) As String
dim strData as string
using srFile as IO.streamReader = New IO.StreamReader(strFilePath)
strDAta = srFile.ReadToEnd.ToString
end Using
return strData
End Function
Test Yr Project And E-mail Me for Any FAQ :)

No comments:

Powered By Blogger