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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.