Combine functionality with MSHFLEXGRID controls and Command controls

xiaoxiao2021-03-06  40

'I have given you an example as a vsflexgrid table control and a normal button control:' Table Control Name: MyGrid 'button Control Name: Command1' Notes: When the form is put, the button control is placed! Otherwise, you can't see the effect! '--- Defining Form Private Sub Form_Load () Command1.visible = False with MyGrid .cols = 3.Rows = 3 .TextMatrix (0, 0) = "Learn" .TextMatrix (0, 1) = "Sex". TextMatrix (0, 2) = "Age" .TextMatrix (1, 0) = "0001" .TextMatrix (1, 1) = "Male" .TextMatrix (1, 2) = "20" .TextMatrix (2, 0) = "0002" .TextMatrix (2, 1) = "Female" .TextMatrix (2, 2) = "22" End Withend Sub

Private sub mygrid_click ()

With mygrid if .rows = 1 or.Row = 0 THEN EXIT SUB SELECT CASE .COL CASE 0 'If the user clicks on the first column to handle Command1.top 20 command1.left = .left .cellleft 20 Command1.Width = .CellWidth - 10 Command1.Height = .CellHeight - 10 Command1.Visible = True Command1.Caption = "you want the button name" Command1.SetFocus Case Else Command1.Visible = False End SelectEnd Withend Sub

Private submmand1_click () 'Writing the program you want to process MSGBox ("Learn:" & myGrid.TextMatrix (MyGrid.Row, 0)) End Sub ----------------- ----------------------------------------- or above is my personal practice, there is a problem Can contact me! Everyone helps each other! Oh ....... QQ: 7422224, indicate VB when looking for me

转载请注明原文地址:https://www.9cbs.com/read-51464.html

New Post(0)