Save And Load ???
hi i got this code from a firend,
Code:Private Sub ReadFromFile() Dim LineOfText As String Dim i As Integer
Open Text2.Text For Input As #1 On Error GoTo TooBig: 'set error handler Do Until EOF(1) 'then read lines from file Line Input #1, LineOfText Text1(i).Text = LineOfText i = i + 1 Loop
CleanUp: Close #1 'close file Exit Sub TooBig: 'error handler displays message MsgBox ("The specified file is too large.") Resume CleanUp: 'then jumps to CleanUp routine End Sub
Public Sub WriteToFile() Dim i As Integer Dim ctrl As TextBox Open Text2.Text For Output As #1 For Each ctrl In form19.Text1 Print #1, Text1(i).Text i = i + 1 Next
Close #1 'close file End Sub
and i got no idea where it saves or loads to, the file name
can you guys help
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Load/Save From/to Txt?
I'm a beginner with visual basic. i guess we could start there..
Private Sub Save1_Click()
Open (App.Path & " emp.txt") For Output As #1
variabelone = Text1.Text
Print #1, variabelone
Close #1
End Sub
These rows will save whatever text there is in "text1" to a text document called temp. Some similar rows will load whatever temp.txt containes and output that in text2.
This far no problem. I wrote this to prepare myself for the saving part in a game im programming in visual basic. The problem with this system is that, to save a game in my game, you will need at least 300 of those txt:s. And that is not an option according to me.
I know it is possible in some very easy way, but i can't find anywhere telling my how to do it:
How can i save and load information to/from a specific Row in a text document? (so i can use ONE txt-file, containing 300 rows, instead of 300 files, containing one each...)
thanks //sam
Save/load
im srry if this was posted before but how do i save/load cause im makeing a game n i want a save/load in it but i dont know how.....help plz
LV1 Save / Load
How do I save the ListView1 data in a format so I can load all the data back into the columns? I don't know how to save it or load it back into the columns. Can someone show me an example or what I should look out for?
Thanks
Silver
Save/Load
I have a text editor, where, of course, I'll want to be able to Save/Load. I have 2 command buttons in a second form which I want to be able to click to open a Save Window. Now, I have managed to make a window open that lets me type in an address to save the file at, but I would like to be able to browse and save. The same thing goes with Load. Can anybody help?
Load/Save
Hi, can anybody help me? I'd like to know how I can save and load Caption(or another properties of Label) into/from a txt file?
Save/load
i just want a button to be save and one for load and when i click save it just saves a file with everything on the list and loads that again if i click on the load button
Save/load
does anyone know the code to save/load like a video game save/load. Ex Final Fantasy 7 u know how u can save then load when ever u want. ty if u can help and still waiting on help with other problem click here
Save/Load
Why wont this work?
VB Code:
Private Sub mnufileload_Click() Dim TheSave As Integer 'load file Dim MyFileName As String CommonDialog1.DialogTitle = "Open File" On Error GoTo No_Open CommonDialog1.ShowOpen Open CommonDialog1.FileName For Input As #1 TheSave = Input(1, I) Close 1 lblcash.Caption = TheSave Exit SubNo_Open:End Sub Private Sub mnufilesave_Click() 'save file I = lblcash.Caption CommonDialog1.DialogTitle = "Save File" CommonDialog1.Flags = cdlOFNOverwritePrompt On Error GoTo No_Save CommonDialog1.ShowSave Open CommonDialog1.FileName For Output As #1 Write #1, I Close 1 No_Save:End Sub
thx in advance
Using VB To Load From And Save To A XML?
I have been searching for about 6 hours and have yet to find ANYTHING about saving to / loading from a XML in VB.
Any links/help would be appreciated
Thanks,
Replex
(The XML im trying to work with can be found here: http://www.angelfire.com/empire/httpgamesq/settings.xml copy + paste if it doesnt work)
Save/Load
What is incorrect in this code?
I am trying to save a string called save in savefile.txt.
Option Explicit
Dim listadd As String
Dim save As String
Dim x As Integer
Private Sub Command1_Click()
listadd = Text1.Text
save = listadd
List1.AddItem (listadd)
End Sub
Private Sub mLoad_Click()
Open App.Path & "savefile.txt" For Input As #1
Input #1, save
List1.AddItem (save)
Close
End Sub
Private Sub mSave_Click()
Open App.Path & "savefile.txt" For Output As #1
Write #1, List1.ItemData(x)
Close
End Sub
Save And Load
I have written this timesheet application, but I have run into a snag. When you first run it, it works great. I have it set up to put a msgbox up if there are not any times to calculate. Once you save it, then load it and run it, if there a no times to calculate it gives me a mismatch error. It seems to just skip the msgbox step and give me an error. Would anyone like to take a crack at this one. I am sure it is simple enough, I'm just not seeing it. I have attached the ZIP file for anyone interested. Perhaps someone can enlighten me on a better way to do it.
Thanks, Dave
Save/load
Hi all!
I wrote a piece of software and I need to insert a couple buttons that would save and load the settings. I already export all the settings to some .txt files. But what if I want to import them back and make all the checkboxes and buttons corespond to the saved settings. I have no idea on how to start on even creating the menus to save to a file and load from a file (you know, like a save and an open button in word for example). Please send me any pointers or maybe websites that have articles about this problem.
Thanks.
Is There A Set Load And Save Window?
Hi guys, Ive made a Load window, in which you can choose ur drive and directory, and select a file but its abit ropey. so is there any set examples out there?
Cheers
How To Save/load A Game
Hiya,
I did a search of the forums, but I did not find any clear information on how to write the code for saving and/or loading a game.
Basically, I'm working on a kingdom simulator that is full of different variables, such as Treasury amount, population size, taxation level, industrial population size, etc.
I'm looking for a code that would let me save the game and also let me load it from a while later on so I can continue playing from where I left off.
Any suggestions?
Thanks in advance
Save / Load Map In DirectX 7.0
I would like to have feature that let users to type in the filename they want to save , and also to load their desired file with filename shown in a custom designed box .
So far i have thought of some ideas on how to do the saving part ,
that is to use Directinput , drawtext for typing the text ( filename) , and then save it using I/O function ( not entirely sure this is the right way). but i 'mhaving difficult on figuring out a way to do the file loading part during in game process.
ANy help would be greatly appreaciated
Save/Load Listbox
I have the following code in a modual and it works fine when called form one. I close form one and open form two and when called it says the file dosen't
exist. I've even tryed hard coding the full path in form two and get the same result.
Public Sub LoadList(Dir As String, SpellingList As ListBox)
Dim I As Integer
Dim Word As String
On Error GoTo ERR:
I = FreeFile
Open Dir For Input As #I
Do While Not EOF(I)
Input #I, Word
SpellingList.AddItem Word
Loop
Close #I
Exit Sub
ERR:
MsgBox "File dosen't Exist"
End Sub
Load And Save Programs
i am working on a text editer and i wondering how to save and load my programs
i am also trying to figure out how to display the line and charecter number on a status bar!
Any Ideas?
Save/Load Picture On DB
Hello, Iss there any body who know coding for Save and Load Picture on Database (SQL 2000)
thnx
Yasir
Save && Load A File
iv got 3 text box's, studentID, firstname, and last name. and two command buttons, write and read.
this is the code iv used to write it:
recordlength = Len(student)
filenumber = FreeFile
Open "c: est.fil" For Random As filenumber Len = recordlength
Put #filenumber, 1, student
Close #filenumber
Text1.Text = studentid
Text2.Text = student.FirstName
Text3.Text = student.LastName
wen i look at the file though, the data hasnt wrote to it but it has spaces wer the data should be, so it has done something.
can any1 help me get it to write properly please so that when i open the file it contains the text that i have inputted?
Save/Load Dialog
Hello Everybody,
I've searched through the forum, but I can't find it anywhere, how can I get my program to show the save thing, which is also shown when you save wordt or so, and how does it work, can I add makss and stuff like...any tutorial or comment on this would be great
Create Save And Load
Is there a way I can create a secure file (In a direcotry chosen by the user) that can only be read be VB and it must be able to save a look up information inputted by the user. I.E. names
File Load And Save?
What the heck am i doing wrong? I have a textbox that i am entering notes into. The form wont get closed much but when it does i need it to the save notes in a text file. Here's code im using:
Dim notesave as string
open "c:documents and settingsowner
otes.txt)" for output as #1
notesave = text1.text
print #1, notesave
close #1
AND
Dim noteload as string
open "c:documents and settingsowner
otes.txt)" for input as #1
input #1, noteload
text1.text= noteload
close #1
I dont have any save or load buttons, i want the notes to be written to the file and saved when the form is exited. Now when i load program back up i want to open file and add my saved notes into the text1.text again. Basically just want my info loaded and saved everytime i load and exit. Thanks for any help, has me stumped.
Auto Save Load Again
I've already asked this question once but i didnt understand any of the replies:
I want to open my program, and when i close it i want the items in list1 to save to a textfile in the same folder as the program.
and when i open my program i want the text from a textfile in the same folder to load into list1
Whats the code?
Load And Save Text
How do I Save a text from ex. a text box to a specific line in a text file.(ex. line 4 in a text file) And how do I then load that specific line back to the text box?
And how do i do the above but insted of saving the text in a text file on the HDD, I save it to a text file in a Resource File?
Code in VB6 plz i you can help me...
//Andi. A newbie at VB6
Save/load Arrays To Txt
How would I take an array and save it to a txt file. And how would I load that file to populate an array?
I am making a program where a form is filled out several times. Each time, the fields are dumped into an array.
Thanks
Gilmesh
The REAL Way To Save And Load...
In a normal dos based text box. How do you do it? If I manually create a file with the contents: "Hello" it may open as "??llo" or something in my app. What is the PROPER way to save and open dos based text files??
Load Save Delete New Etc
Anyone know where I can get simple jpg or bitmap of
Open
Save
File
Delete
Etc
Have some but look a bit crappy
thanks
Load And Save Label
i know this is easy because i have done this before but cannot figure out the codeing. ok what i need is some code which loadeds data from a text file and saves data to it as well. i need the file to load the data to a label.
any ideas?
Save/load UDT Arrays
None of the code examples I've found seem to work. Or at least, I can't seem to make them work. I want to save and load a udt array to and from a binary file. Little help?
Code:
Option Explicit
Public Type NodeType
Left As Long
Top As Long
Image As Long
Active As Boolean
cnn() As Long
Connections As Long
End Type
Public gtypNodes() As NodeType
Sub Main()
LoadTestData
SaveToFile App.Path & " est.dat"
Erase gtypNodes
LoadFromFile App.Path & " est.dat"
End Sub
Private Sub SaveToFile(pstrFIle As String)
' ???
End Sub
Private Sub LoadFromFile(pstrFIle As String)
' ???
End Sub
Private Sub LoadTestData()
ReDim gtypNodes(4)
With gtypNodes(0)
.Left = 185
.Top = 1500
.Image = 1
.Active = True
.Connections = 2
ReDim .cnn(1 To 2, 1 To 2)
.cnn(1, 1) = 1
.cnn(2, 1) = 0
.cnn(1, 2) = 2
.cnn(2, 2) = 1
End With
With gtypNodes(1)
.Left = 2100
.Top = 1050
.Image = 1
.Active = True
.Connections = 1
ReDim .cnn(1 To 2, 1 To 1)
.cnn(1, 1) = 0
.cnn(2, 1) = 0
End With
With gtypNodes(2)
.Left = 1600
.Top = 850
.Image = 2
.Active = True
.Connections = 1
ReDim .cnn(1 To 2, 1 To 1)
.cnn(1, 1) = 0
.cnn(2, 1) = 1
End With
With gtypNodes(3)
.Active = False
End With
With gtypNodes(4)
.Left = 600
.Top = 500
.Image = 2
.Active = True
.Connections = 0
End With
End Sub
Load And Save Excel
hi i know very little of programming but can't figure out some codeing for a program of mine.
i need a small app which can save a excel file, as well as load it within visual basic.
i tried playing around with visual basic today and came across something which said OLE or something. it seems to be exactly what i was looking for but am not able to save the file currently loaded, not choose an excel file to load. any ideas on how i can approach this? basically i need an app which can load an excel file as well as saveing it?
Take Screenshot, Save It, Load It
How can i make an app that takes a screenshot, saves it as a jpg then loads it in a picturebox?(I dont want it to load it straight away, it has to save it first)
Save/load Program
Hi there.
I need some help creating a program that will allow me to load and save files that are using a particular program. Eg. Say i have some program open, and I want to use VB6 to load/save the file insted of using the program itself.
I'm kind of new to the whole Programming scene, so can anyone help me with the source code or direct me to a good tutorial?
---ESQ---
Save And Load Richtextbox?
RichTextBox1.SaveFile App.Path & "datafile.txt" when i try to save the contents in richtextbox using that code, it seems like it saves everything including the front style + text + font size. how do i make it so it only saves the text?
Best Way To Save And Load JPEGs?
I've been working on software to stealthly monitor a PC from a remote location, for parents, bosses, etc.... anyway, as far as screen shots go, working with transferring 2+ MB files for one shot over a network is NOT fun heh. What's the best and easiest way to save/load JPEG files in VB?? Thanks!!
-Mike
Save And Load Forms
Hi everyone. Another beginner's question:
I have vb5. I've always written my save / load file forms on my own, using objects such as drive1, file1, dir1, and writing code for them. (actually I wrote one the first time and then pasted it where I needed)
Well, is there a way to quickly create form with the look of the ones in win2k and office 2k? I mean with those icons such as desktop, documents, my computer... on the left side and with those icons (upper level, back, create new folder) on the top of the form? Writing one on my own would take hours, wouldn't it?
Maybe there's a place where I can download one and then customize the code to my needs?
Thank you everyone!
Bye!
Save And Load [Resoulved]
I'm having trouble with this code:
Code:
Option Explicit
' Fcode program
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbPopupMenuLeftButton Then ' pop up box on left click
PopupMenu (edt) ' open edit menu
End Sub
Private Sub newF_Click()
Dim theForm As New FCode ' call the form a part of Fcode
theForm.Show vbModal ' this form show
Set theForm = Nothing
End Sub
Private Sub opnf_Click()
'doesn't work at the moment
'opnf.Filter = "All Files (*.*)|*.*| Fight Code(*.FPG)|*.FPG|"
'opnf.FilterIndex = 2
'opnf.ShowOpen
'Program = opnf.FileName
End Sub
Private Sub svasf_Click()
'svasff.Filter = "All Files (*.*)|*.*| Fight Code(*.FPG)|*.FPG|"
'svasf.FilterIndex = 2
'svasf.ShowSave
'Program = svasf.FileName
End Sub
My probemes are:
1) pops up a menu saying Method or function not defined when I try opening and saving.
2) The part with the right click
PopUpMenu (edt) gives me a "warning" saying non value variable or somthing of the sort. This is all in VB. Please help me. Give very detailed expamples and help please.
Save And Load From Hex[unresolved]
what i need to do is i pretty much want a bas file that will open a file in hex find a string in the hex replace it with another string then save the app as a new file. does anybody know of a base file somewhere that can do that
Need Help On Load/save Function..
I need help on this to make load / save function work..
PS: you can download the exampple and work on that,much easier... But please help!!
What i need here is for the save function to save each item from the list in a new line in the "data.ads" , and for the load function
to clear the list and read each line ,correctly into the list again...
Can anyone help me??
Im stuck, cause i don't know enough...
VB Code:
Private Sub Command3_Click()List1.ClearEnd Sub Private Sub Command4_Click() Dim ls ls = List1.ListCount - 1 List1.ListIndex = 0 'MsgBox ls Open App.Path & "Data.ads" For Random As #1 List1.ListIndex = ls For e = 0 To ls Put #1, , SplitTab(0) & vbTab & "€€" & vbTab & SplitTab(1) Next e Close #1End Sub Function SplitTab(nr)'If List1.ListIndex = -1 Then List1.ListIndex = 0Dim Tabs() As StringTabs = Split(List1.Text, vbTab)SplitTab = Tabs(nr)End Function Private Sub Form_Load()Dim i 'count valueList1.ClearFor i = 0 To 20List1.AddItem "ehh: " & i & vbTab & "Item: " & iNext iEnd Sub Private Sub Command1_Click()'sort/search buttonDim fnd As IntegerDim strTemp, strTemp2List1.ListIndex = 0For fnd = 0 To List1.ListCount - 1''MsgBox fnd 'Need To AutoSelect Item In List Here'Start at first item and ending on last itemList1.ListIndex = fnd 'this gives a "invalid property value" Dim SplitTab() As StringSplitTab = Split(List1.Text, vbTab)strTemp = SplitTab(0)strTemp2 = SplitTab(1)''MsgBox strTemp 'Show you what it does 'strTemp = List1.List(fnd)If InStr(1, strTemp, Text1.Text) Then List1.RemoveItem fndList1.AddItem strTemp & vbTab & strTemp2, 0End IfNext fndList1.ListIndex = 0List1.ListIndex = -1 End Sub Private Sub Text1_Change()Text1.Text = ""End Sub
Best Save And Load Options
Ok well im looking for the best way to save and load(Below is what I have)...Thx guys
VB Code:
On Error GoTo Error_Killer With CD1 .DialogTitle = "Save Log File" .Filter = "All Supported Types|*.log;*.crk;*.txt|" .ShowSave Dim Nbr As Long On Error Resume Next Open .FileName For Output As #1 For Nbr = 0 To List1.ListCount - 1 Print #1, List1.List(Nbr) Next Nbr Close #1 End With Exit SubError_Killer:Exit Sub To Load:On Error GoTo 1 With CD1 .DialogTitle = "Open User File" .Filter = "All Supported Types|*.usr;*.txt;*.dat|" .ShowOpenDim sText As String Dim x As Integer x = FreeFile On Error Resume Next Open .FileName For Input As #x While Not EOF(x) Input #x, sText$ If sText$ = "" Then Exit Sub Else List1.AddItem sText$ DoEvents End If Wend Close #x End With Exit Sub1Exit Sub
I was wondering if that code above is the best way to laod and save or is there better ways? Editing or adding stuff in or whatever to make it better in any way would Be very much appreciated
.bmp Save/load Problem
i first want to say thanks again to Mc Brain for helping me the first time --
i have almost conquerered the winsock sendfile. on the server side, i take a screenshot, save it as a .bmp , read it into a string, and send the string data. on the client(recieving side), i take the string data and once it is complete i save it as a .bmp file. however i can not preview this file and when i try to open it in windows explorer i recieve this error message :
c:program filesmicrosoft visual studiovb98capturescreenshot12-20-02.bmp
Paint Cannot Read This File
This is not a Valid Bitmap File, or the format is currently unsupported.
umm guys? any ideas?
thanks in advance
How To Load/Save Icons?
Hi
I would like to make an icon editor ( and i know hundreds of people have made them, but I want to make one for practise ) but im not sure how to actually load an icon, or save it for that matter.
Is there any API that does it or anyone wrote a function that does it or any descriptions about icons anywhere?
thanks
IDE Save/Load Directory
Whenever I add a form, module or something to my project and then do a save as the dialog always defaults to c:Program FilesMicrosoft Visual StudioVB6
Is there any way to override this and set it to something different?
Cheers
Save, And Load Features?
I have 2 command buttons on my form. I need someone to help me with writting code for each. I dont care where the "save" button saves to, But I want the load button to Load the List of data that person just saved.
Thanks,
Jason
Load/Save Icon
Yo all
i need a code which saving an ico files and opening ico files (into picture or something)
can some1 plz post the code here?
Load/Save Dialogs - How Are They Used?
Does anybody know how I can make use of the load/save common dialogs to load/save text to and from variables?
Many thanx
Edited by - glennandrewcooper on 12/29/2003 7:36:44 AM
Load/add Text/save A PNG In VB6 SP5
Hi there,
I've been searching the net for 2 days now to find a solution for this "should be" easy problem.
I need to load an existing PNG that has transparency, print some text on it and save it back to PNG, without losing the transparency.
Can anybody please help me?
Kind regards and thanks in advance,
Filip
Save / Load To Text File
Hi Guys,
I have a real big request.
I am totally stuck on how to write the contents of a text box to file, and load it back in at a later stage.
Could some one show me how to do it.
I have attached a form, which is highly simplified, but if some one could demostrate on it how to Save to file, and Load back, that would be great.
I need the option of when pressing save, to be able to select where it is saved to, and what to call it.
Many thanks
Kieran Grayy
PS: I only started VB a couple of weeks ago, and this isnt a school / uni project, its just for my football team - cheers
|