Jag har en form med en richtextbox som man kan byta typsnitt på. Ett exempel finns på din disk för VB, leta efter mdi.vbp.Spara typsnitt
Hur kan jag göra om jag vill att samma typsnitt ska komma fram i den nästa gång jag startar min applikation???
Jag vet att det finns nå´t som heter SaveSettings men får det ej att funka.
Tacksam för svar /JonasSv: Spara typsnitt
<code>
Sub GetRecentFiles()
' This procedure demonstrates the use of the GetAllSettings function,
' which returns an array of values from the Windows registry. In this
' case, the registry contains the files most recently opened. Use the
' SaveSetting statement to write the names of the most recent files.
' That statement is used in the WriteRecentFiles procedure.
Dim i, j As Integer
Dim varFiles As Variant ' Varible to store the returned array.
' Get recent files from the registry using the GetAllSettings statement.
' ThisApp and ThisKey are constants defined in this module.
If GetSetting(ThisApp, ThisKey, "RecentFile1") = Empty Then Exit Sub
varFiles = GetAllSettings(ThisApp, ThisKey)
For i = 0 To UBound(varFiles, 1)
frmMDI.mnuRecentFile(0).Visible = True
frmMDI.mnuRecentFile(i).Caption = varFiles(i, 1)
frmMDI.mnuRecentFile(i).Visible = True
' Iterate through all the documents and update each menu.
For j = 1 To UBound(Document)
If Not FState(j).Deleted Then
Document(j).mnuRecentFile(0).Visible = True
Document(j).mnuRecentFile(i + 1).Caption = varFiles(i, 1)
Document(j).mnuRecentFile(i + 1).Visible = True
End If
Next j
Next i
End Sub
Sub WriteRecentFiles(OpenFileName)
' This procedure uses the SaveSettings statement to write the names of
' recently opened files to the System registry. The SaveSetting
' statement requires three parameters. Two of the parameters are
' stored as constants and are defined in this module. The GetAllSettings
' function is used in the GetRecentFiles procedure to retrieve the
' file names stored in this procedure.
Dim i, j As Integer
Dim strFile, key As String
' Copy RecentFile1 to RecentFile2, and so on.
For i = 3 To 1 Step -1
key = "RecentFile" & i
strFile = GetSetting(ThisApp, ThisKey, key)
If strFile <> "" Then
key = "RecentFile" & (i + 1)
SaveSetting ThisApp, ThisKey, key, strFile
End If
Next i
' Write the open file to first recent file.
SaveSetting ThisApp, ThisKey, "RecentFile1", OpenFileName
End Sub
</code>
/Pelle