Solved

Editable Flexigrid

Posted on 2001-08-10
9
845 Views
Last Modified: 2008-03-17
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
0
Comment
Question by:hmnpa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6373714
0
 
LVL 14

Expert Comment

by:wsh2
ID: 6373723
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
 
LVL 3

Accepted Solution

by:
andysalih earned 40 total points
ID: 6374752
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 3

Expert Comment

by:andysalih
ID: 6374762
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
 
LVL 3

Expert Comment

by:andysalih
ID: 6374769
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
 

Author Comment

by:hmnpa
ID: 6374770
Thanks Andy

I have been careless. Sorry for that. I have resolved all the previous questions.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 6374796
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
 

Author Comment

by:hmnpa
ID: 6378742
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
 
LVL 3

Expert Comment

by:andysalih
ID: 6384327
your very welcome hmnpa.



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

lol

:op

andy
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question