Hvordan fan.... laver man en function som kan bruges på samme måde som Session("login") = "?"
Jeg har prøvet med dette her, men det funker sku ikke :-(
'Public Property Get Session() As Variant
'Session = m_Session3
'End Property
Public Property Let Session(ByVal vNewValue As Variant)
m_Session1 = vNewValue
End Property
Public Property Set Session(ByVal vNewValue As Variant)
MsgBox vNewValue
End Property
Private Sub Command1_Click()
Session("login") = "?"
End Sub
OKAY hvad er Session er det en variable, i så fald af hvilken type
det samme m_Session og m_Session3
jegkanikke hjælpe dig før!
Jeg vil bare have en function hvor jeg kan hente dataen ind/ud på denne måde
Session("string1") = "string2" ' Data ind
xx = Session("string1") ' Data ud xx er nu string2
den skal funke på samme måde som "ASP" "Session" gør.
Jeg har fået det til at virke, hvis nogen vil se hvordan så er koden her. :-)
Option Explicit
Private m_Session As Object
Public Property Get Session() As Object
Set Session = m_Session
End Property
Private Sub Form_Load()
Dim varName As Variant
Set m_Session = CreateObject("Scripting.Dictionary")
Session("Name") = "Username" 'Tilføje
Session("Pass") = "Password" 'Tilføje
Me.Caption = Session("Pass") 'Vis indhold af Pass
'Lav en liste over indhold
For Each varName In Session
List1.AddItem varName & " = " & Session(varName)
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set m_Session = Nothing
End Sub