How vb dynamically creates a TextBox and undoes a Textbox

Updated on technology 2024-04-11
11 answers
  1. Anonymous users2024-02-07

    option explicit

    dim x as control

    private sub command1 click() dynamically creates a textbox

    set x = "", "text", me)with x

    width = 1000

    height = 500

    visible = true

    left = 200

    top = 100

    end with

    end sub

    private sub command2_click()on error resume next

    x 'Delete the created textbox

    end sub

  2. Anonymous users2024-02-06

    Drag a textbox first, the name text1, index set to 0, (index must be set).

    Load textbox:

    load text1(1)

    load text1(2)

    load text1(3)

    Uninstall textbox:

    unload text1(1)

    unload text1(2)

    unload text1(3)

  3. Anonymous users2024-02-05

    To do this, add 1 text box text1 and set its index property to 0

    With the following**:

    option explicit

    dim a as textbox, b as longprivate sub form_load()b = 1

    end sub

    private sub command1_click()b = b + 1

    load text1(b)

    text1(b).backcolor = rgb(255, 255, 255)

    text1(b).text = "hjonny"

    text1(b).borderstyle = 0text1(b).move 0, 0, 2155, 255text1(b).visible = trueend sub

    private sub text1_change(index as integer)

    text1(index).text

    end sub

    There is still a problem to solve, you this button 1, you can continue to add text boxes, to modify appropriate**

  4. Anonymous users2024-02-04

    Get one first, and then drag the crtl + left mouse button, and it comes out, and there is no duplicate name to try.

  5. Anonymous users2024-02-03

    This demand is completely unnecessary. Defining a textbox array is all that goes wrong.

  6. Anonymous users2024-02-02

    private sub command1_click()dim a as textbox

    dim i as integer

    for i = 0 to 9

    set a = "", "text" & i)= true

    i * 500, i * 400, 1000, 300= rgb(255, 255, 255)

    text" & i

    next "Dynamically adding the control succeeded"

    end sub

  7. Anonymous users2024-02-01

    1.First of all, you are dynamically adding the textbox text box, then you dim a as label must not match the type, you can directly dim a

    2.The textbox text box does not have a caption attribute, only a text attribute.

    After modifying these two places, it is ready to be executed.

  8. Anonymous users2024-01-31

    Otherwise, if you press paste, you can make the characters more than 2 digits.

    Enter **:

    private sub text1_change()if len( >= 2 then

    Note">"No. can not be. Just to prevent emergencies. Causes the characters to exceed 2 but is not executed. But if you already set maxlength to 2, you shouldn't need it.

    end sub

    I suggest the full **:

    private sub text1_change()if len( >= 2 then : = 0: = len(end sub

    It would be nice that way. Suppose you text2 has already entered something. When text1 goes to text2, all characters of text2 are automatically selected.

    If you want to modify it, you can directly enter and overwrite the original content. There is no need to manually delete the original content of text2 or select all and re-enter it.

  9. Anonymous users2024-01-30

    Use the function len() to determine if it has entered two digits, and then use the if statement to make it reach two digits and let the next textbox get focus.

  10. Anonymous users2024-01-29

    Add the following **:: to the change event of text1:

    if len( = 2 then

    i.e.: private sub text1 change()if len( = 2 then

    end if

    end sub

  11. Anonymous users2024-01-28

    I've written some small programs before.,Sometimes you need to empty all the textbox content in the form.,And there's a lot of textbox in the form.,At this time, it's the most headache.,Write one sentence at a time:

    If there are a dozen textboxes. Wow, my life is so miserable) and then I thought of using an array of controls, although there are fewer statements, just :

    for i=1 to n

    textboxarray(i).text=""

    next, but the name of each textbox is the same, but it is lowered.

Related questions
13 answers2024-04-11

On the first floor, your method generates an array of controls that can't respond to events.

9 answers2024-04-11

A class has a good class spirit, where students live and learn, grow up healthily and enjoy it; Teachers are very interested and enjoy the lessons; The head teacher is very handy and enjoys it. Then the class teacher has the responsibility to build a democratic and equal, harmonious environment, strong learning style, strong cohesion of the class atmosphere, so that each student regards this class as their own home, everyone loves her, and thinks of her all the time; What about sharing the glory and disgrace with her, and sharing the sorrows? Let me talk about my views from three aspects: the stability of the class, the cohesion of the class, and the development of the class >>>More

12 answers2024-04-11

There are many ways to do this, but here are a few simple ones: >>>More

5 answers2024-04-11

Parameter description: rndnumcount, the number of 6 digits; mysearchnum, the number to look for. >>>More

13 answers2024-04-11

Free to build the method.

3. Then select a province at random, click the "Search" button, select one of the displayed schools to enter, and then enter the name of the new group in the class name of "Register a new class", and finally click "OK". >>>More