Dear Sir/Madam,

I want to know two things here..

1. Can we create object variable on Run time?
2. Can we store one object variable's data (Object) into another object variable?

Please guide me sir/madam. Because, i have no idea in this regard.

Recommended Answers

All 2 Replies

what you mean exactly..
post more informations..

Private Sub CmdLoadTextBox_Click()
Dim TopPosition As Integer

NoOfControl = Val(Trim(Text1.Text))

    TopPosition = 3000

    For A = 1 To NoOfControl Step 1
        'Here i want to create an object variable (How many, it will depend on
        '"NoOfControl" variable)
        
        Set TxtBox = Me.Controls.Add("vb.TextBox", "TxtBox" + Trim(Str(A)))
        'And here i want to place object(textbox) into new object variable
        'newobjectvariable = object variable (Textbox)
        With TxtBox
            .Left = 3000
            .Top = TopPosition
            .Width = 1000
            .Height = 500
            .Visible = True
            .DragMode = 0
        End With
    
        TopPosition = TopPosition + 1000
    Next A

End If

End Sub

Dear JX Man,

I have posted the sample codes where/why i need the new object variable and storing the object variable into an object variable. Please see my comments on the codes.

I think this information will be enough for you. Thanks for replying sir and waiting

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.