|
| ||||||||||
| Tags: html, source code, vbnet |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| View HTML Source in a VB.net Program
|
|
#2
| ||||
| ||||
| Re: View HTML Source in a VB.net Program
Dim webResponse3 As System.Net.HttpWebResponse = Nothing Dim webRequest3 As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.yahoo.com") Try webResponse3 = DirectCast(webRequest3.GetResponse(), System.Net.HttpWebResponse) Dim srResp As System.IO.StreamReader srResp = New System.IO.StreamReader(webResponse3.GetResponseStream()) dim SOMESTRING as string SOMESTRING = srResp.ReadToEnd Catch ex As Exception End Try |
|
#3
| ||||
| ||||
| Re: View HTML Source in a VB.net Program
This example will show you how use a string in VB to create PHP code.In order to do this, you need a string to store your PHP page and a function that I will list at the bottom of the page for you to put in a module. This code is written in VB.NET Public Sub CreatePage(ByVal HTMLTitle As String, ByVal HTMLText As String, ByVal HTMLFileName As String) Code: Dim strFile As String ' ---------------------- ' -- Prepare String -- ' ---------------------- strFile = "" ' -------------------- ' -- Write Starter -- ' -------------------- strFile = "<html>" & vbNewLine strFile = strFile & "<head>" & vbNewLine strFile = strFile & "<title>" & HTMLTitle & "</title>" & vbNewLine strFile = strFile & "</head><body>" & vbNewLine strFile = strFile & HTMLText & vbNewLine strFile = strFile & "</body></html>" SaveTextToFile(strFile, "C:\" & HTMLFileName & ".html") End Sub module of your program. Public Function SaveTextToFile(ByVal strData As String, _ ByVal FullPath As String, _ Optional ByVal ErrInfo As String = "") As Boolean Code: Dim Contents As String Dim Saved As Boolean = False Dim objReader As IO.StreamWriter Try objReader = New IO.StreamWriter(FullPath) objReader.Write(strData) objReader.Close() Saved = True Catch Ex As Exception ErrInfo = Ex.Message End Try Return Saved End Function |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "View HTML Source in a VB.net Program" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using PHP to extract Source IP from email header input via HTML form | TimB | Software Development | 1 | 08-06-2012 12:42 PM |
| Unable to view the source code in Firefox | Siketan | Technology & Internet | 5 | 14-04-2011 12:42 AM |
| View HTML files in Kindle | GurdeepS | Portable Devices | 4 | 22-03-2010 07:52 PM |
| Java program to retrieve html source | Aaliya Seth | Software Development | 5 | 12-01-2010 10:59 AM |
| How to View HTML Source Code in Word 2007 | Rutajit | Windows Software | 3 | 08-08-2009 12:50 PM |