Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 03-01-2004, 05:49 PM   #1
Member (6 bit)
 
Join Date: Aug 2003
Posts: 61
Save Functionality in VB 6.0

I making a program that is similar to Notepad. How do I a save and open funtionality to the program.



Thanks.
fustrated is offline   Reply With Quote
Old 03-01-2004, 11:28 PM   #2
Member (7 bit)
 
Join Date: Sep 2003
Posts: 90
well, they already did the code for the open/save dialog boxes. i forget the exact code as i have only dabbled in vb for a little while, but if you want, i can look at my old work.

but, this dialogue box is only a fancy way of getting a filename, after that, your open/save code must read/write to that file.

simply and naively, this can be done with

Dim NextLine As String
On Error GoTo ErrHandler
Open InFile For Input As #1
Line Input #1, NextLine
Close #1
Exit Sub
:ErrHandler
MsgBox "you did something wrong", . . .
End Sub

for writing:

Dim NextLine As String
On Error GoTo ErrHandler
Open OutFile For Output As #1
Print #1, "foo"
Close #1
Exit Sub
:ErrHandler
MsgBox "you did something wrong", . . .
End Sub

this means of writing/reading is machine dependent, meaning windows will output \r\n for newlines, unix \n, macs \r. and inputting will only read until it reaches \r\n, \n, \r depending on os. this really does not matter (but, in my case it did).

there is probably a better way of doing this. check out some vb boards. that is where i got my help.

AS
AerynSedai is offline   Reply With Quote
Old 03-01-2004, 11:31 PM   #3
Member (7 bit)
 
Join Date: Sep 2003
Posts: 90
oh, silly me.
this is using the built in "File" control widget do-dad. these are added just like buttons, lists, radios, etc.

AS
AerynSedai is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:48 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2