Avatar of rp
rp
Flag for Portugal asked on

Create a textbox from a variable

Hi,

This is not correct, but how can create a textbox for ex. from a variable, somethig like:

            Dim xx As String
            Dim xx As New TextBox()

best regards
Visual Basic.NET

Avatar of undefined
Last Comment
Jacques Bourgeois (James Burger)

8/22/2022 - Mon
Fernando Soto

Hi rflorencio;

This is not possible to do. What do you need to do that needs this type of requirement?
ASKER CERTIFIED SOLUTION
Ark

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
rp

ASKER
Hi,

I have some "parameters", like startdate, enddate, prductid for ex. to generate reports. But sometimes i only need for ex. startdate and enddate, others only productid, others all them. I alread done a code to generate controls in runtime mode. But my goal is read the "parameter" for ex. startdate and create a textbox control called startdate to get date, etc ...

best regards
rp

ASKER
I get it.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Jacques Bourgeois (James Burger)

You usually create controls dynamically when you do not know beforehand how many controls you coudl need. As an example, if I have a form that has buttons to print reports, and I cannot know when I build application how many reports will be available. This could be done with the technique described by Ark.

In your case however, you know how many controls you might need. In such a situation, it is usually better to create your form as you would, with all the possible controls, but set the the Visible or Enabled property of those that might not be needed to False. The controls are in the form, but the user sees them as inactive (Enabled) or does not see them (Visible).

When, when you need to display information in these controls, simply reset the property to True so that it is activated or visible.