Re: How to refer to a class property while in that class. (Solved)

Tech-Archive recommends: Fix windows errors by optimizing your registry



still not working as expected (trying several methods). Here is
exactly what im doing.

Main code:------------- (assume there is a post variable:
existing="no")

Set dp = new classDataProcessor

If len(session("token")) < 20 Then
' this must be a new visit. Lets get a token
dp.MakeToken
End IF

' new or existing?
If Request.Form("existing") = "no" Then
' we want to make a NEW form.
dp.MakeNew
Else
' not relevent to this post
End If

Response.Write("my token is: " & dp.token)





Class Code:----------------

Class classDataProcessor


Private m_token


Public Property Get Token()
Token = m_token
End Property

Public Property Let Token(p_data)
' private - this should be set only by makeToken()
m_token = p_data
session("token") = p_data
End Property





Public Function makeToken()
' Generates a token. Stores it in the Token Property of this class
Dim i
Dim tmpToken
Dim randnum
Dim Values
Vals =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-()!#,[]"
Randomize
'While need to make sure its not taken in the tmp table
For i = 1 to 20
randnum = int(rnd*len(Vals)) +1
tmpToken = tmpToken & mid(Vals,randnum,1)
Next
'Wend

'Me.Token = tmpToken
'm_token = tmpToken
token = tmpToken
session("token") = tmpToken
makeToken = true
End Function



Public Function makeNew()
If Len(Token) <> 20 Then
'If Len(m_token) <> 20 Then
'If Len(me.Token) <> 20 Then
Response.Write("in makeNew: " & Token & ".")
MakeToken
End If

Dim sql
SQL = "INSERT INTO imf (TMP_Token,TMP_LastTouch,form_name) " &
_
" VALUES('" & Me.Token & "'," & _
" now()," & _
" 'test')"
'DBHandle.ExecuteUpdateSQL(SQL)
Response.Write(SQL)
makeNew = True
End Function




--------------------------------------------------------
I don't see what im doing wrong. Token is always empty when the makenew
function is called. Do you see that i am doing something wrong?

.



Relevant Pages

  • Re: How to refer to a class property while in that class. (Solved)
    ... Yet it is updating a Session ... Public Property Let Token ... Dim tmpToken ... Public Function makeNew() ...
    (microsoft.public.scripting.vbscript)
  • Re: Rearrange desktop
    ... Dim m_htTitlebar ' used in geom calcs ... Const GWL_STYLE = ... Sub RepositionDesktopIcons() ... Public Property Let Mask ...
    (microsoft.public.scripting.vbscript)
  • Re: Selection.Information(wdActiveEndPageNumber) zeigt falsche Seitenzahl
    ... Die Properties werden von einem VB-Programm heraus gesetzt und sind als globale Variablen in einem Modul in Word hinterlegt... ... Public Property Let EnableUebertrag ... Public Sub DateiDruckenStandard() ... Dim i As Integer, j As Integer ...
    (microsoft.public.de.word.vba)
  • Re: Concurrency violation
    ... Public Sub SendAllSMS() ... Dim ds As New Data.DataSet ... Dim NewDat As String ... Public Property ODBC_ConnectionStringAs String ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: Change the display resolution
    ... Dim bCloseFlag ' t/f if user closed the form... ... Sub ChangeScreenResolution ... private const definitions apparently DON'T WORK in a class code. ... Public Property Get dmBitsPerPel ...
    (microsoft.public.scripting.wsh)