FastFiber

Checkbox aan laten staan

Gestart door martijn, wo 20 01 2010, 17:02:24

Vorige topic - Volgende topic

martijn

Ja ja, weer even aan het tobben met het VBA programmeren.

Nu heb ik hetvolgende. Op een formulier heb ik een checkbox gezet welke bepaald of het formulier na het plaatsen van een blok terug moet komen of niet.
Als je eruit gaat, wordt het formulier ge Unload en ben je de instelling van de checkbox ook weer kwijt. Kun je ergens instellen dat hij dit moet bewaren of ergens anders deze instelling op moet halen?

Martijn

sschevers

Martijn,

Dit soort instellingen kun je opslaan in de registry. Met het command SaveSetting sla je waardes op en met Getsetting haal je de waardes weer op uit de registry. Zie onderstaande uitleg vanuit de help

GetSetting Function
     

Returns a key setting value from an application's entry in the Windows registry or (on the Macintosh) information in the application's initialization file.

Syntax

GetSetting(appname, section, key[, default])

The GetSetting function syntax has these named arguments:

Part Description
appname Required. String expression containing the name of the application or project whose key setting is requested. On the Macintosh, this is the filename of the initialization file in the Preferences folder in the System folder.
section Required. String expression containing the name of the section where the key setting is found.
key Required. String expression containing the name of the key setting to return.
default Optional. Expression containing the value to return if no value is set in the key setting. If omitted, default is assumed to be a zero-length string ("").



Remarks

If any of the items named in the GetSetting arguments do not exist, GetSetting returns the value of default.


SaveSetting Statement
     

Saves or creates an application entry in the application's entry in the Windows registry or (on the Macintosh) information in the application's initialization file.

Syntax

SaveSetting appname, section, key, setting

The SaveSetting statement syntax has these named arguments:

Part Description
appname Required. String expression containing the name of the application or project to which the setting applies. On the Macintosh, this is the filename of the initialization file in the Preferences folder in the System folder.
section Required. String expression containing the name of the section where the key setting is being saved.
key Required. String expression containing the name of the key setting being saved.
setting Required. Expression containing the value that key is being set to.



Remarks

An error occurs if the key setting can't be saved for any reason.

greetz Stephan

martijn

Da's iets ingewikkelder dan ik gehoopt had, maar super bedankt ik ga er vanmiddag even mee stoeien.

EddyBeerke

Je kunt ook een globale variable maken.
Pas als je acad afsluit gaat de instelling verloren.
Als dat niet erg is dan lijkt mij dat je beter van het register van windows af moet blijven.
Een andere optie om iets dergelijks te bewaren is bv een INI bestand waarin je de waarde opslaat en voor later gebruik weer kunt lezen.
Civil3d 2026, Blender 4.x gebruiker
Gebruiker sinds AutoCAD R12

http://eddylucas.c1.biz/
https://www.google.com/maps/contrib/109381066561676463628/photos/

stonie

Misschien een beetje laat, maar dan toch voor de volgende.
In de opgeslagen tekening zitten standaard 5 USERI variabelen.
Deze zijn te gebruiken om later weer uit te lezen, dus misschien een optie voor jouw probleem ?

Sub test()
'uitlezen
MsgBox ThisDocument.GetVariable("USERI5")
'invullen
ThisDocument.SetVariable "USERI5", 1
End Sub

Stonie

FastFiber