Now we will practice how to use the control Mshflexgrid in a form. Open a new project in VB6, then add Mshflexgrid control and a CommandButton control. Let the names of the control by default.
 
How to Use Mshflexgrid

 Type the following code in the CommandButton.
 
 Private Sub Command1_Click()
 Dim Nomor(5)
 Dim Names(5)
 Nomor(1) = "10001"
 Nomor(2) = "10002"
 Nomor(3) = "10003"
 Nomor(4) = "10004"
 Nomor(5) = "10005"
 Names(1) = "Abraham"
 Names(2) = "Pill Collin"
 Names(3) = "Collina"
 Names(4) = "Stoner"
 Names(5) = "Paul"
 With MSHFlexGrid1
      .Rows = 6
      .Cols = 3
      .TextMatrix(1, 1) = Nomor(1)
      .TextMatrix(1, 2) = Names(1)
      .TextMatrix(2, 1) = Nomor(2)
      .TextMatrix(2, 2) = Names(2)
      .TextMatrix(3, 1) = Nomor(3)
      .TextMatrix(3, 2) = Names(3)
      .TextMatrix(4, 1) = Nomor(4)
      .TextMatrix(4, 2) = Names(4)
      .TextMatrix(5, 1) = Nomor(5)
      .TextMatrix(5, 2) = Names(5)
 End With
 End Sub
 

 Then in the main menu vb6, run the program. It will produce a display like the image above.
 
 

More topic of Mshflexgrid
 
 -. MSHFlexgrid
 -. Mshflexgrid with Adodc
 -. Editable MSHFlexgrid
 -. Attach textbox to MSHFlexgrid
 -. Select Single Cell in MSHFlexgrid
 -. MSHFlexgrid select a cell and change background

Categories: