Originally, the msflexgrid control skills were presented through the encoding rule control of basic classification files in ERP. You only need to add a msflexgrid and combo control to the control. The source code is as follows:
Option explicit
Private sub combow.click ()
Msflexgrid1.text = combo1.text
End sub
Private sub combow.keypress (keyascii as integer)
If keyascii = vbkeyescape then
Combo1.visible = false
Msflexgrid1.setfocus
Exit sub
End if
If keyascii = vbkeyreturn then
Msflexgrid1.text = combo1.text
Combo1.visible = false
Msflexgrid1.setfocus
End if
End sub
Private sub combow.lostfocus ()
Combo1.visible = false
Msflexgrid1.setfocus
Exit sub
End sub
Private sub form_load ()
Dim I as integer
Dim width, text, Archives
Width = array ("400", "2100", "800", "800", "800", "800", "800", "800", "800 ", "800", "800 ")
TEXT = array ("no.", "file name", "1st", "2nd", "3rd", "4th", "5th ", "level 6th", "level 7th", "level 8th", "level 9th ")
Archives = array ("null", "subject", "project category", "fixed asset category", "Department Category", "employee category", "supplier category ", "Customer classification", "seller Classification", "Region Classification", "warehouse receiving and picking category", "Inventory Classification", "Reserved 12", "Reserved 13", "Reserved 14 ", "reserved 15", "Reserved 16", "Reserved 17", "reserved 18", "Reserved 19", "reserved 20 ")
With msflexgrid1
. Rows = 21
. Cols = 11
. Fixedcols = 2
. Fixedrows = 1
End
For I = 1 to 9
Combo1.additem I
Next I
For I = 0 to 10
Msflexgrid1.colwidth (I) = width (I)
Msflexgrid1.textmatrix (0, I) = text (I)
Next I
For I = 1 to 20
With msflexgrid1
. Textmatrix (I, 0) = I
. Textmatrix (I, 1) = archives (I)
. Rowheight (I) = 300
End
Next I
End sub
Private sub msflexgrid1_click ()
Dim C as integer, R as integer
With msflexgrid1
C =. Col
R =. Row
If C> 1 and R> 0 then
Combo1.left =. Left +. colpos (c) + 50
Combo1.top =. Top +. rowpos (r) + 50
Combo1.width =. colwidth (c)
Combo1.text =. Text
Combo1.visible = true
Combo1.setfocus
End if
End
End sub
Private sub msflexgrid1_keypress (keyascii as integer)
If keyascii = vbkeyreturn then
Call msflexgrid1_click
End if
End sub