Editable Flexigrid

Hi

I want to make the Microsoft Flexigrid editable. I read somewhere that it is possible. If someone knows, please let me know. It is urgent.

Thanks
hmnpa
hmnpaAsked:
Who is Participating?
 
andysalihConnect With a Mentor Commented:
will allow users to edit flexi grid, hope its what you want



Private Sub MyFlexGrid_KeyPress(KeyAscii As Integer)
    'Provides manual data entry capability t
    '     o flexgrid


    With MyFlexGrid


        Select Case KeyAscii
            Case vbKeyReturn


            If .Col + 1 <= .Cols - 1 Then
                .Col = .Cols - 1
            ElseIf .Row + 1 <= .Rows - 1 Then
                .Row = .Row + 1
                .Col = 0
            Else
                .Row = 1
                .Col = 0
            End If
            Case vbKeyBack


            If Trim(.Text) <> "" Then
                .Text = Mid(.Text, 1, Len(.Text) - 1)
            End If
            Case Is < 32
            Case Else


            If .Col = 0 Or .Row = 0 Then
                Exit Sub
            Else
                .Text = .Text & Chr(KeyAscii)
            End If
        End Select
End With
End Sub


cheers
Andy
0
 
wsh2Commented:
Urgent?

Questions Asked 26
Last 10 Grades Given A A B A A A B A A B  
Question Grading Record 13 Answers Graded / 13 Answers Received
Answers  
Questions Answered 0

13 Open questions dating back to at least October of last year. PLEASE tend to them (add a comment to get them going.. grade.. or delete them) before I give you an answer here.

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
andysalihCommented:
ps, if the code i have submitted works for you then please dont leave this question unattended like wsh2 has stated.

let me also give you some friendly advice "if you dont reward points to previous questions you have asked, experts tend not to answer you question."

example....
wsh2's comment.



i don't blame him but i will give you the benefit of the dout.

cheers
Andy

0
 
andysalihCommented:
also there is a program you can download, full source code,

http://www.planetsourcecode.com/xq/ASP/txtCodeId.23425/lngWId.1/qx/vb/scripts/ShowCode.htm


that may help you

cheers
Andy
0
 
hmnpaAuthor Commented:
Thanks Andy

I have been careless. Sorry for that. I have resolved all the previous questions.
0
 
wsh2Commented:
1. Start a New Standard.Exe Project.
2. Add 1 "Microsoft Flex Grid" (MSFlexGrid1) to Form1.
3. Add 1 TextBox (Text1) to Form1.
4. Copy/Paste the following into the Form1 code window.
5. Press F5 to Run. Type what you want into the FlexGrid. Use the arrow keys to navigate.

<----- Code Begin ----->

Option Explicit

Dim m_intDirection As Integer

Private Sub Form_Load()
   
   Form1.Move _
      Screen.Width * 0.1, _
      Screen.Height * 0.1, _
      Screen.Width * 0.8, _
      Screen.Height * 0.8
   
   With MSFlexGrid1
      .Cols = 10
      .Rows = 10
      .ScrollTrack = True
   End With
   
   With Text1
      .Text = ""
      .FontBold = True
   End With
   
End Sub

Private Sub Form_Resize()

   MSFlexGrid1.Move 0, 0, ScaleWidth, ScaleHeight
   With MSFlexGrid1
      Text1.Move .CellLeft - 30, .CellTop - 30, .CellWidth + 30, .CellHeight
      Text1.ZOrder 0
   End With
   
End Sub

Private Sub MSFlexGrid1_GotFocus()

   Call MSFlexGrid1_RowColChange

End Sub

Private Sub MSFlexGrid1_RowColChange()

   With MSFlexGrid1
      Text1.Move .CellLeft - 30, .CellTop - 30, .CellWidth + 30, .CellHeight
      Text1.Text = .TextMatrix(.Row, .Col)
      Text1.SelStart = 0
      Text1.SelLength = Len(Text1.Text)
      Text1.SetFocus
   End With

End Sub

Private Sub Text1_Change()

   With MSFlexGrid1
      .TextMatrix(.Row, .Col) = Text1.Text
   End With

End Sub

Private Sub Text1_Keyup(KeyCode As Integer, Shift As Integer)

   Dim intDirection As Integer

   Select Case KeyCode
      Case vbKeyDown
         intDirection = 1
      Case vbKeyUp
         intDirection = 2
      Case vbKeyReturn
         intDirection = m_intDirection
      Case vbKeyRight
         intDirection = 3
      Case vbKeyLeft
         intDirection = 4
   End Select
   
   With MSFlexGrid1
      Select Case intDirection
         Case 1 ' Down
            m_intDirection = intDirection
            If .Row + 1 >= .Rows Then
               .Row = .FixedRows
            Else
               .Row = .Row + 1
            End If
         Case 2 ' Up
            m_intDirection = intDirection
            If .Row - 1 < .FixedRows Then
               .Row = .Rows - 1
            Else
               .Row = .Row - 1
            End If
         Case 3 ' Right
            m_intDirection = intDirection
            If .Col + 1 >= .Cols Then
               .Col = .FixedCols
            Else
               .Col = .Col + 1
            End If
         Case 4 ' Left
            m_intDirection = intDirection
            If .Col - 1 < .FixedCols Then
               .Col = .Cols - 1
            Else
               .Col = .Col - 1
            End If
      End Select
   End With

End Sub

<----- Code End ----->


0
 
hmnpaAuthor Commented:
Thanks Andy

You have been a great help. WSH2's answer is also a good one, but since you were the first to answer, and you also were so kind, I am giving the points to you.

Thanks very much
hmnpa
0
 
andysalihCommented:
your very welcome hmnpa.



ps. hey WSH2, just got in first, just in the nip of time

lol

:op

andy
0
All Courses

From novice to tech pro — start learning today.