Results 1 to 8 of 8

Thread: Msflexgrid

  1. #1

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Post

    Is there a way to change the width of the columns or the height of the rows? can you make it so users can enter data into it? Thanks oh and when you do additem can you add it to a different col instead of always col 1?

    ------------------
    Sincerely,
    Chris

    just have fun out there and live life to the fullest while it is still here
    Email [email protected]

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284

    Post


    'set column width
    MSFlexGrid1.colwidth(0) = 2500
    'enter text
    MSFlexGrid1.TextMatrix(1,1) = "Entering text"

  3. #3
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    You can't actually edit an MSHFlexgrid. But you can make it look like you're editing it.
    [*]What you do, is set up a textbox, Text1 and set it's border to none.
    [*]Then when the user clicks the MSHFlexgrid, or presses a key while it has the focus have the textbox pop up and automatically size itself to be the exact same size as the cell in the MSHFlexgrid, using the MSHFlexgrid.CellHeight, MSHFlexgrid.CellWidth
    [*]Then have it align itself over the top of that cell using MSHFlexgrid.Left + MSHFlexgrid.CellLeft to align the left side and MSHFlexgrid.Top + MSHFlexgrid.CellTop to align the top.
    [*]Then the user can type whatever they want into the textbox and when they press Enter or something just save what is in the textbox to the MSHFlexgrid by using something like this: MSHFlexgrid.TextMatrix(MSHFlexgrid.Row, MSHFlexgrid.Col) = Text1.Text

    That should work. That's what I did.

    ------------------
    Ryan

    [This message has been edited by Gimpster (edited 02-18-2000).]

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    If you'd like me to send you a demo project that uses the method Gimpster describes, email me.

    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    If you'd like me to send you a demo project that uses the method Gimpster describes, email me.

    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Actually, yes, you can, edit cells in the MsFlexGrid. Here's an example. Use this code on KeyPress event of the MsFlexGrid:

    Code:
    Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
        With MSFlexGrid1
            Select Case KeyAscii
                Case 8
                    If Not .Text = "" Then
                        .Text = Left(.Text, Len(.Text) - 1)
                    End If
                Case Else
                    .Text = .Text & Chr(KeyAscii)
            End Select
        End With
    End Sub
    ------------------

    Serge

    Senior Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819

  7. #7
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Oh, ok, Serge, I guess that works. I was just going by what the MSDN files said. But that would sure be a lot easier than what I used. I've probably got about 1 to 2 pages of code for my editing routine.

    ------------------
    Ryan

  8. #8
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    I know, I have that too. In my project I had to use MSFlexGrid with Textbox and Combobox, to give the user an ability to edit.

    The only bad thing about using KeyPress event is that you don't see the blinking carret.

    ------------------

    Serge

    Senior Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width