|
-
Oct 8th, 2000, 07:34 PM
#1
Thread Starter
New Member
help me please, i am designing an html editor, i want to know how i can save text1.text as an html file through the save dialog box
html, visual basic, and javascript, they all rule
-
Oct 8th, 2000, 07:48 PM
#2
Addicted Member
Do this:
1: Place the common dialog control and a command button on your form and use the following code.
Code:
Private Sub cmdSave_Click()'cmdSave being the name of your command button
Dim CDialog As cCommonDialog
Set CDialog = New cCommonDialog
CDialog.Filename = Filename
CDialog.Filter = "HTML |*.html*"
CDialog.ShowSave
FilePathName = CDialog.Filename
If CDialog.Filename = "" Then Exit Sub
End If
End Sub
Hope that helps.
-
Oct 8th, 2000, 07:58 PM
#3
Close Stephen Bazemore.
Code:
Private Sub cmdSave_Click()
Dim iFile As Integer
On Error GoTo User_Cancelled
With CommonDialog1
.CancelError = True
.DialogTitle = "Save..."
.Filter = "HTM Files (*.htm)|*.htm"
.ShowSave
iFile = FreeFile
If .filename = "" Then Exit Sub
Open .filename For Output As iFile
Print #1, Text1.text
Close iFile
End With
User_Cancelled:
End Sub
-
Oct 8th, 2000, 08:03 PM
#4
Addicted Member
aww man.. i was feeling all good about helpin him.. now you gotta blow it for me.. haha. Well mine works, but yours is better. So go with matthews.
"Because matthew is Always right."
-
Oct 8th, 2000, 08:08 PM
#5
Yours is just the same Steven, I only added things. And a few other stuff .
-
Oct 8th, 2000, 08:13 PM
#6
Addicted Member
I was just jokin around.
-
Oct 8th, 2000, 10:03 PM
#7
Thread Starter
New Member
my version
here is my version, it says in the dialog box in the save as type box "html File (*.html) but if i dont actully name the file blahblah.html it tells me it doesnt exist and crashes... here is code
Private Sub Command1_Click()
Screen.MousePointer = vbNormal
Dim nFile%
Dim vDummy$
CommonDialog1.Action = 2
Screen.MousePointer = vbHourglass
nFile% = FreeFile
Open CommonDialog1.FileName For Output As #nFile
Print #nFile, Text1.text
Close #nFile
Screen.MousePointer = vbNormal
End Sub
html, visual basic, and javascript, they all rule
-
Oct 8th, 2000, 10:07 PM
#8
Addicted Member
err.. Why not just use the code Matthew posted and add the
Code:
Screen.MousePointer = vbNormal
and
Code:
Screen.MousePointer = vbHourglass
to it?
Because if your saving the file "nFile" then it will already be in your textbox, so why do you need to re-print it into it? correct me if i'm wrong, but that's how I see it.
-
Oct 9th, 2000, 09:14 AM
#9
Thread Starter
New Member
ummm
someone gave me that code, i knew it was wack, ill try his
what should i put in the filter properties of the dialog so i just type a name and it says as an html file
html, visual basic, and javascript, they all rule
-
Oct 9th, 2000, 09:19 AM
#10
Thread Starter
New Member
ok, to open files
i know i can keep the same dialog box, but how would i load the html into text1.text
html, visual basic, and javascript, they all rule
-
Oct 9th, 2000, 10:58 AM
#11
Quite easy as well. This will read it into a text file:
Code:
Private Sub cmdOpen_Click()
Dim iFile As Integer
On Error GoTo User_Cancelled
With CommonDialog1
.CancelError = True
.DialogTitle = "Select a HTM File.."
.Filter = "HTM (*.htm)|*.htm"
.ShowOpen
iFile = FreeFile
If .filename = "" Then Exit Sub
Open .filename For Input As iFile
Text1 = Input(LOF(iFile), iFile)
Close iFile
End With
User_Cancelled:
End Sub
-
Oct 9th, 2000, 05:46 PM
#12
Thread Starter
New Member
thanks
you guys are helping out bigtime, i ill test this: how do i put in another filter, a new pair of quotes? and does that make the drop down list longer? now here is the inportant question:
how do i make a preview button so when clicked, the file opens in internet explorer? i know it has somthing to do with temporery files, and, how at the end, it delets the temp
html, visual basic, and javascript, they all rule
-
Oct 9th, 2000, 05:50 PM
#13
Thread Starter
New Member
error in open code
on this part of the code, it highlighted input and said could not find project or library
Text1 = Input(LOF(iFile), iFile)
html, visual basic, and javascript, they all rule
-
Oct 9th, 2000, 07:36 PM
#14
Thread Starter
New Member
wow
thanks you guys, i will prob have more questions, but i just started vb class 4 weeks ago, and before that i had no expierience with that, i was dimming things before the teach told us about that, he asked me if i read the book, i said no, i went online and learned some vb script, this other kid in the class, he has chunky soup dandruff, really nasty ****, i just ate, so i wont talk about it, he is good, but he cant do **** on his comp cuz its 100 mghz, i have got to be teh most advanced kid in that class, now along with internet applications, i also "<i>own</i>" this class to, could you guys explain what each part of these codes do, or point me to a really good guide? this html is gonna be wicked sweet soon, im gonna convert all my buttons to graphical, using fireworks: coold 3d 1, and 3, and paint shop pro 7, all of which i downloaded for free: thanks warez, anyway, is there a way to put flash into a program, and just make the program a shell for flash?
html, visual basic, and javascript, they all rule
-
Oct 9th, 2000, 07:41 PM
#15
Thread Starter
New Member
is this the code:
Code:
Dim iFile As Integer
On Error GoTo User_Cancelled
With CommonDialog1
.CancelError = True
.DialogTitle = "Select a HTM File.."
.Filter = "HTM (*.htm)|*.htm"
.ShowOpen
iFile = FreeFile
If .FileName = "" Then Exit Sub
Open .FileName For Input As #1
Text1 = Input(LOF(1), 1)
Close #1
End With
User_Cancelled:
its still highliting the input and saying library not found
html, visual basic, and javascript, they all rule
-
Oct 9th, 2000, 08:15 PM
#16
Q1: Do you have this line anywhere in your project? Option Explicit
Q2: What version of VB are you using?
-
Oct 9th, 2000, 09:44 PM
#17
Thread Starter
New Member
my version
i have vb 2.0 and chipmunk basic: j/k i have visual studio 6.0
,ill put option explicit in
html, visual basic, and javascript, they all rule
-
Oct 9th, 2000, 09:51 PM
#18
You don't really need Option Explicit.
But try this instead of Input, try using Binary.
Code:
Open .FileName For Binary As #1
start$ = 1
buffer1$ = String$(10000, 0)
Get #1, start$, buffer1$
Text1.Text = Text1.Text & buffer1$
Close #1
-
Oct 10th, 2000, 10:30 AM
#19
Thread Starter
New Member
woa
ill try it, are you telling me you know binary as well, holy crap dude, do you know it pure? and how would you write a program in total binary
html, visual basic, and javascript, they all rule
-
Oct 10th, 2000, 11:22 AM
#20
Thread Starter
New Member
preview code
the preview has a bug, it only loads the html thats in the body part of my code, and if i dont have any html when i preview, it crashes, i can fix that with a msgbox but how do i make it load the head of the html also
html, visual basic, and javascript, they all rule
-
Oct 10th, 2000, 02:07 PM
#21
0100001001101001011011100110000101110010011110010010000001100001011100110010000001101100011010010110 101101100101001000000111010001101000011010010111001100111111
CONVERTED: Binary as like this?
(Sorry about the skipping...bugs!)
I need a little more information, are you using the Webbrowser (IE) Control as a reference?
If you don't like this way, you could always save it to your app's directory and load it through IE.
Code:
Private Sub cmdPreview_Click()
Open App.Path & "\preview.htm" For Output As #1
Print #1, Text1.Text
Close #1
DoEvents
If Dir(App.Path & "\preview.htm") <> "" Then
Shell (App.Path & "\preview.htm")
Else
MsgBox "Error: Preview file missing!", vbCritical
End If
End Sub
^This way would take up less resources .
-
Oct 10th, 2000, 03:14 PM
#22
Thread Starter
New Member
ok
ill try this way with the temp file, i wanted to know what program you write binary in, like visual basic? anyway, i realyl dont care, i dont need to learn binary... do i?
lol, could you point me to a really good online tutorial for VB?
html, visual basic, and javascript, they all rule
-
Oct 10th, 2000, 03:24 PM
#23
For tutorials and stuff for VB, you should stick to these sites:
http://www.vb-world.net
http://forums.vb-world.net
http://www.planet-source-code.com
http://www.vbapi.com
http://www.allapi.net
If you stick to these sites, you will learn much.
And you don't really need to know that kind of Binary to program in VB.
Good luck!
-
Oct 11th, 2000, 02:34 PM
#24
Thread Starter
New Member
thanks man
i showed the code for that to my teach today (i keep getting an automation error when i click preview) and as usal he said , uuuuuhhhh lemme consult the book, he kept the code, and hid it! at the end of class i found it in his folder and took it back, what a loser! thanks for your help
html, visual basic, and javascript, they all rule
-
Oct 11th, 2000, 02:44 PM
#25
he kept the code, and hid it! at the end of class i found it in his folder and took it back, what a loser! thanks for your help
What code? The Preview one? That should work. Maybe your missing some files or something?
-
Oct 11th, 2000, 03:20 PM
#26
Re: ok
Originally posted by kuker
[B]i dont need to learn binary... do i?/B]
No, you don't need to learn binary for now, however, you will need to learn some when you get into lower level languages.
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
|