I need to save information to a file name, how do I write the code to a file? The code is from an prior answer
that I got.
Afterwards: How can I retrive the file name again?
Code:'You can use Registry, which will store all those values.... 'in form_Load u can call the registry key which will give the previous stored value. 'here text1 stores the actual value of marks of a user(whose name is in text3), do give the name differently each time u save otherwise the previous value in the registry will be overwritten 'here text2 stores the actual value of average of a user(whose name is in text3) Option Explicit Private Sub Command1_Click() 'Save to Registry SaveSetting App.Title, "Scores", "Marks" & Text3.Text, Text1.Text SaveSetting App.Title, "Scores", "Average" & Text3.Text, Text2.Text End Sub Private Sub Command2_Click() 'Get the values from the Registry or u can write this code in the form Load event also thats up to U. On Error GoTo y Dim mysettings As Variant Dim intsettings As Integer List1.Clear mysettings = GetAllSettings(App.Title, "Scores") 'Adds the series of marks and average values into a listbox serially from the registry For intsettings = LBound(mysettings, 1) To UBound(mysettings, 1) List1.AddItem mysettings(intsettings, 1) Next intsettings y: If Err.Number = 13 Then MsgBox "There are no Entries to Show", vbExclamation, "Error" Exit Sub End If End Sub




Reply With Quote