Home > Software engineering >  Vb how to choose a good data import part of data into the datagrid control
Vb how to choose a good data import part of data into the datagrid control

Time:09-25


As shown in figure, how to choose a good four data import into the datagrid control below, (there are a series of data is to lose yourself, so choose the datagrid control), and when a row after losing, can automatically import the above four data to the second line, and so on, into the first n rows, until the click the "save" button

CodePudding user response:

The datagrid seems to be no good, because is online data, switch the GRID control

CodePudding user response:

Such as what kind of the grid control

CodePudding user response:

Col, Row attribute sample
The examples put the "Here" in the current unit, and then the program unit change into the third row of the third unit, and put the "s" in the cell, try this example, use the "parts" dialog in the tool box to add an MS Flex Grid Control (in the "project" menu, select the "components", then the selected Microsoft Flex Grid Control), and then draw a Grid on the new form, to run the program, please press the F5 key, and then click on the Grid,

 Private Sub Form_Load () 
MSFlexGrid1. Rows=8 'set the Rows and columns,
MSFlexGrid1. Cols=5
End Sub

Private Sub MSFlexGrid1_Click ()
'put the text in the current unit,
MSFlexGrid1. Text="Here"
'put the text in the third row, the third column,
MSFlexGrid1. Col=2
MSFlexGrid1. Row=2
MSFlexGrid1. Text="s"
End Sub


The next example shows that the position of the active unit, and when the user selects a cell or cell range, the range of selected in the notice that the selected a range, the activities of the unit does not change, select a range, and then click the form to make activity unit along the selected range of surrounding mobile note that the selected range does not change,

You want to try this example, please create a new project, use the "parts" dialog box (in the "project" menu, select the "components", then check that the Microsoft Flex Grid Control) add an MS Flex Grid Control, and then draw a MS Flex Grid and two labels, copy the code to declaration section, and then press F5 to run the program,

 Private Sub Form_Load () 
MSFlexGrid1. Cols=6 'set the rows and columns,
MSFlexGrid1. Rows=7
End Sub

Private Sub MSFlexGrid1_RowColChange ()
Msg="Active Cell:" & amp; CRH (64 + MSFlexGrid1. Col)
The Mst=Msg & amp; MSFlexGrid1. Row
Label1. Caption=Msg
End Sub

Private Sub MSFlexGrid1_SelChange ()
Msg="Selection:" & amp; CRH (64 + MSFlexGrid1 SelStartCol)
Msg=Msg & amp; MSFlexGrid1. SelStartRow
Msg=Msg & amp; ":" & amp; CRH (64 + MSFlexGrid1 SelEndCol)
Msg=Msg & amp; MSFlexGrid1. SelEndRow
Label2. Caption=Msg
End Sub

Private Sub Form_Click ()
'every click on the form, the process
'is along the selected
'range of surrounding mobile unit activities,
Dim GR, GC As Integer
If MSFlexGrid1. Row=MSFlexGrid1. SelStartRow Then
If MSFlexGrid1. Col=MSFlexGrid1. SelEndCol Then
GR=1: GC=0
The Else
GR=0: GC=1
End the If
ElseIf MSFlexGrid1. Row=MSFlexGrid1. SelEndRow Then
If MSFlexGrid1. Col=MSFlexGrid1. SelStartCol Then
GR=1: GC=0
The Else
GR=0: GC=1
End the If
The Else
If MSFlexGrid1. Col=MSFlexGrid1. SelStartCol Then
GR=1: GC=0
The Else
GR=1: GC=0
End the If
End the If
MSFlexGrid1. Row=MSFlexGrid1. Row + GR
MSFlexGrid1. Col=MSFlexGrid1. Col + GC
End Sub
  • Related