|
-
Jun 14th, 2006, 04:27 PM
#1
Thread Starter
New Member
Vb > Html
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
Last edited by Leomarth; Jun 14th, 2006 at 04:27 PM.
Reason: add line
-
Jun 14th, 2006, 10:42 PM
#2
PowerPoster
Re: Vb > Html
Do you want to send something from a VB program to a webpage ..? Or the other way around ..?
-
Jun 15th, 2006, 02:03 AM
#3
Thread Starter
New Member
Re: Vb > Html
I want to take information that my users generate in a program, and display it in a html file once complete.
-
Jun 15th, 2006, 02:16 AM
#4
PowerPoster
Re: Vb > Html
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
-
Jun 15th, 2006, 05:29 PM
#5
Thread Starter
New Member
Re: Vb > Html
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?
-
Jun 15th, 2006, 10:01 PM
#6
PowerPoster
Re: Vb > Html
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
-
Jun 16th, 2006, 09:19 PM
#7
Thread Starter
New Member
Re: Vb > Html
Ok, when the computer gets to "DoesFileExist", it tells me Sub or Function not Defined.
-
Jun 17th, 2006, 02:09 AM
#8
PowerPoster
Re: Vb > Html
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|