Can someone shoot me to a good tutorial on how to make your program take information from it, and slip it into HTML code?
This is for VB6
Printable View
Can someone shoot me to a good tutorial on how to make your program take information from it, and slip it into HTML code?
This is for VB6
Do you want to send something from a VB program to a webpage ..? Or the other way around ..?
I want to take information that my users generate in a program, and display it in a html file once complete.
so sounds like you just want to create a html file with the data they enter then display it to them ..
If so basically you just create the html page as you would a text file .. ofcourse enter in the HTML tags etc .. you will need to know how you want it to look and design that part of it ..
Then Shell the page to them ..
Is it the HTML stuff you are having issues with ..?
Rory
No. But, when I put text to a .txt file, it puts quotes around it. For instance, when I put a persons name to a text file, I get this output ---> "George Bush"
Now, I know that HTML tags won't work if they're formatted with quotes around them.
I'm using the WRITE #1, mytext format. Is there a better way without using FSO?
You shouldnt be getting quotes around them unless you are putting them there ..
Here are some things to test with as far as reading and writing to text files ..
VB Code:
Private Sub Command1_Click() Dim sText As String Dim sFile As String Dim sArray() As String Dim iLine As Integer sFile = App.Path & "\myfile.txt" '// FILE EXISTS Debug.Print "File Exists: " & DoesFileExist(sFile) '// CREATE FILE If Not DoesFileExist(sFile) Then WriteFile sFile, Now Debug.Print "New File Created" End If '// UPDATE FILE If DoesFileExist(sFile) Then sText = ReadFile(sFile) Debug.Print "File Text: " & Replace(sText, vbCrLf, vbCrLf & "File Text: ") UpdateFile sFile, vbCrLf & Now Debug.Print "Updated Old File" End If '// LOOP THROUGH LINES sText = ReadFile(sFile) If Len(sText) Then sArray = Split(sText, vbCrLf) For iLine = 0 To UBound(sArray) Debug.Print "File Array (" & iLine & "): " & sArray(iLine) Next iLine End If '// DELETE FILE If DeleteFile(sFile) Then Debug.Print "Deleted File" End If Debug.Print "" End Sub '// READ ALL FROM TEXT FILE Public Function ReadFile(ByVal Filename As String) As _ String Dim iFile As Integer On Error Resume Next iFile = FreeFile Open Filename For Input As #iFile ReadFile = Trim$(Input$(LOF(iFile), #iFile)) If iFile > 0 Then Close iFile End Function '// WRITE TO TEXT FILE Public Function WriteFile(ByVal Filename As String, _ ByVal Filetext As String) As Boolean Dim iFile As Integer On Error Resume Next iFile = FreeFile Open Filename For Output As #iFile Print #iFile, Filetext; If iFile > 0 Then Close iFile If Err = 0 Then WriteFile = True End Function '// APPEND TO TEXT FILE Public Function UpdateFile(ByVal Filename As String, _ ByVal Filetext As String) As Boolean Dim iFile As Integer On Error Resume Next iFile = FreeFile Open Filename For Append As #iFile Print #iFile, Filetext; If iFile > 0 Then Close iFile If Err = 0 Then UpdateFile = True End Function '// DELETE TEXT FILE Public Function DeleteFile(ByVal Filename As String) _ As Boolean On Error Resume Next Kill Filename If Err = 0 Then DeleteFile = True End Function '// CHECK FILE EXISTS FSO METHOD Public Function DoesFileExist(ByVal Filename As String) As _ Boolean Dim objFso 'As FileSystemObject (reference) On Error Resume Next Set objFso = CreateObject("Scripting.FileSystemObject") If (objFso.FileExists(Filename)) Then DoesFileExist = True End If Set objFso = Nothing End Function
Ok, when the computer gets to "DoesFileExist", it tells me Sub or Function not Defined.
Are you sure you included it in the form ..?
VB Code:
'// CHECK FILE EXISTS FSO METHOD Public Function DoesFileExist(ByVal Filename As String) As _ Boolean Dim objFso 'As FileSystemObject (reference) On Error Resume Next Set objFso = CreateObject("Scripting.FileSystemObject") If (objFso.FileExists(Filename)) Then DoesFileExist = True End If Set objFso = Nothing End Function
Can you post your code?