I am working on this project and I am running into a few problems. Well Nothing is working but when you want to open a file.This is the project I have to do.
My project is allow the user to create a new HTML. Open an existing HTML file from your hard drive(which I don't understand that one). Save an HTML file.Also aloud the user to to load HTML file (source only ) From the internet, when the user selects this feature provide a text box and a button to enter the url. I know how to do a textbox and a button. Include an about me page with your name.I am kinda lost on that part with the textbox and url can someone help me.
Here is my code.
Imports System.IO
Imports System.Net
Public Class Form1
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim Open As New OpenFileDialog()
Dim myStreamReader As System.IO.StreamReader
Open.Filter = "Text[*.txt*]|*.txt|All Files[*.*]|*.*"
Open.CheckFileExists = True
Open.Title = "Open File"
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
document.Text = myStreamReader.ReadToEnd()
Catch ex As Exception
End Try
End Sub
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text(*.txt)|*.txt|HTML(*.html*)|*.html|All Files(*.*)|*.*"
Save.CheckPathExists = True
Save.Title = "Save File"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(document.Text)
myStreamWriter.Flush()
Catch ex As Exception
'Do nothing on Exception
End Try
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myRequest As WebRequest
myRequest = WebRequest.Create("http://www.starkstate.edu")
Dim theResponse As WebResponse = myRequest.GetResponse()
Dim responseStream As Stream = theResponse.GetResponseStream()
Dim reader As New StreamReader(responseStream)
End Sub
End Class
This post has been edited by modi123_1: 14 July 2011 - 09:03 AM
Reason for edit:: please use code tags

New Topic/Question
Reply



MultiQuote






|