954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

convert string into object

dim a as checkbox
dim b as string

b= "check1"

a=b

this code give me error.

is ther any fuction to convert string into an object ? like cstr().
or what is the procedure to convert a string into an object ?
plz help me.

i need help

pranto157
Newbie Poster
20 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

Hi,
I think u r trying to create a checkbox on runtime and give it the name stored in variable b. if so below is the code to do it:

Private Sub Command1_Click()

    Dim a As CheckBox
    Dim b As String
    
    b = "check1"
    
    Set a = Controls.Add("VB.CheckBox", b)
    
    With a
        .Visible = True
        .Caption = b
        .Top = 50
        .Left = 50
    End With

End Sub
kb.net
Junior Poster
172 posts since Aug 2007
Reputation Points: 13
Solved Threads: 29
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You