Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String to Object

Status
Not open for further replies.

jimmyCRACKcorn

Programmer
Nov 14, 2003
10
0
0
CA
Is there any way to convert a string to an object

i.e
Dim Str As String
Str = "frmTest"

Dim Obj As Object
Set Obj = Str


 
This seems like contrived code. What is it that you REALLY want to do? If you ask questions that aren't about your real code, you most likely won't get answers that apply to the real code.

Lee
 
Typically, you'd probably be better off understanding what you need first.

Think of Objects as containers...

Yes, objects can contain a string. But you need to define what your object is first.
 
jimmyCRACKcorn,

This is simplest example:

in a form:

Private Sub DemoStringObject()
Dim objString As clsString
Set objString = New clsString

objString.MyString = "ABCD"

MsgBox objString.MyString

Set objString = Nothing

End Sub

in a clsString class module:

Option Explicit

Private mstrString As String

Public Property Get MyString() As String
MyString = mstrString
End Property

Public Property Let MyString(ByVal vNewValue As String)
mstrString = vNewValue
End Property

vladk
 
i think your not understanding my question.

let me re-word it.

i have a form in my vb program. Lets call it frmTest.

i want to be able to go:

Dim Str as String
Str = "frmTest"
str.show vbmodal
 
Do a search in this forum for CallByName.



Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top