[RESOLVED] Clear a privat type variable.
Hi,
Anyone knows how to clear a privat type variable?
Example:
Code:
'//Clear string variable:
MyDATA$ = ""
MyDATA$ = VbNullString
'//Clear long variable:
MyNUM& = 0
How about clearing a private type variable (that have like a million types) in just one line?
Code:
Private Type TYPE1
X1 As String
X2 As Long
X3 As Byte
X4 As Integer
'etc...
End Type
Private Sub Form_Load()
Dim MyVAR As TYPE1
MyVAR.X1 = "Teste"
'//Clearing:
MyVAR = Nothing
Set MyVAR = Nothing
MyVAR = Empty
MsgBox MyVAR.X1 '// Should return nothing ("").
End Sub
'...
'None of these 3 clearing lines work, I know.
How do we do it in vb6? (Please don't tell me that I have to clear each Variable of that type manually? :eek:)
Re: Clear a privat type variable.
Ok, then I won't tell you that.
-tg
Re: Clear a privat type variable.
This probably is not the proper way, but a quick and dirty way could be to create a new variable of the TYPE1 (on creation it will be empty) then assign it to the one you want to clear
Dim MyVAR As TYPE1
Dim MyVarClear As TYPE1
MyVAR.X1 = "Teste"
MyVAR = MyVarClear
Re: Clear a privat type variable.
Verry good idea baja_yu! Thank you!