Access and input data from MSFlexgrid control in VB6

Here is how you can input and retrieve data into and from Microsoft Flex  gridcontol in Visual Basic 6, just drag and drop and text box and flex grid. and do these code

Private Sub Form_Load()
Call MSFlexGrid1_EnterCell
End Sub

Private Sub MSFlexGrid1_EnterCell()
With MSFlexGrid1
Text1.Top = .CellTop + .Top
Text1.Width = .CellWidth
Text1.Left = .CellLeft + .Left
Text1.Text = .Text
End With
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
MSFlexGrid1.Text = Text1
If MSFlexGrid1.Col < MSFlexGrid1.Cols – 1 Then
MSFlexGrid1.Col = MSFlexGrid1.Col + 1
If MSFlexGrid1.Row < MSFlexGrid1.Rows – 1 Then
MSFlexGrid1.Row = MSFlexGrid1.Row + 1
MSFlexGrid1.Col = 1
End If
End If
End If
End Sub

Published by


A developer,teacher and a blogger obsessed with Python,Dart and open source world from India

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.