A flex grid is a common tool used in programming to display information in a row and column format. Flex grids have both horizontal and vertical scroll bars to make user navigation easier. In Visual Basic, a grid on a user interface form can be designed using the "MSFlexGrid" control. The information displayed on the grid usually comes directly from a database table or, in some instances, programmers write the codes to display data on the grid for user evaluation.

Instructions

Things Youll Need:

  • Computer
  • Visual Basic software
  1. Step 1

    Load an existing Visual Basic project by clicking "File" and "Open Project" from the Visual Basic environment and browsing for the filename from the dialog box that pops up. Alternately, you can open the project directly by double-clicking the "[ProjectName].vbp" file from the folder where you last saved your project.

  2. Step 2

    Open the "Form" with the FlexGrid control you want to work on.

  3. Step 3

    Double-click the control on the form that will trigger the action to delete the row on the flex grid. This is usually a command button with the caption "Delete" or similar controls.

  4. Step 4

    Write source code similar to the following on the controls "Event" you chose in Step 3:

    With MSFlexGrid1
    If (.Rows > .FixedRows + 1) Then
    .RemoveItem.Row
    Else
    .Rows = .FixedRows
    End If
    End With

  5. Step 5

    Save your work by clicking "File" and "Save Project" on the menu or by pressing "Ctrl" + "S" on the keyboard.

  6. Step 6

    Back up your database table to revert the data after testing is done.

  7. Step 7

    Click "Run" and "Start" on the menu to run the program. The flex grid should display data from a database table from which the control is bound.

  8. Step 8

    Delete one row of record by clicking the "Delete" button. Repeat the same process to check if the program is running as it should.

  9. Step 9

    Exit "Run" mode and compile your project by clicking "File" and "Make [ProjectName].exe" on the menu.



Categories: , , , , , , , ,

Leave a Reply