Create a Control CommandButton When The Program Runs

         This time we will create a control CommandButton on the programs currently running. In visual basic tutorial will explain how the component or control in VB6 is very easy for the programmer.
 The first step, as usual you open a new project in VB6 or Visual Basic 6.0, then make a new project. Add a form and two control commandbuton.
         Having the first Control CommandButton caption ComandButton1 created as an array so as to have command1 (0) and only command1 (1), then remove the command (1).
         The second Control CommandButton without the array so that his name remains Command2.
 Then in command2 give commands on a click event as follows:
 
 
 Dim i As Integer, iTop As Integer, iLeft As Integer
 Private Sub Command2_Click()
    iTop = Command1(i).Top + Command1(i).Height
    iLeft = Command1(i).Left
    i = i + 1
    Load Command1(i)
    Command1(i).Visible = True
    Command1(i).Left = iLeft
    Command1(i).Top = iTop
    Command1(i).Caption = "CommandButton-" & i
 End Sub
 

          When the program starts, press the button command2, it will create a command (1), command (2), command (3), command (4), command (5) and so on.
 Control Commandbutton
        The above example could also be applied to controls vb6 others, such as is used to the control Option button, Mshflexgrid, listbox, checkbox or textbox and others.

Postingan populer dari blog ini

vb6 msflexgrid

Tutorial Visual Basic 6.0 : Listbox in VB6

Select Single Cell in MSHFlexgrid