Results 1 to 6 of 6

Thread: ListView or MSFlexGrid - User Edit Cells

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    5

    ListView or MSFlexGrid - User Edit Cells

    I have a list view (But I now understand that I may need to use a MSFlexGrid) that is populated with data from a database and I am trying to allow a column to be left blank for user input. Please see the following screen shot.


    The columns that are populated from the db must remain unchanged.

    I am sure there is a simple solution but this one is realy fighting me.

    Thank you in advance.

    Matt

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    5

    Re: ListView or MSFlexGrid - User Edit Cells

    I am still stuck on this one so if anybody can help I would be very greatful.

    Matt

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ListView or MSFlexGrid - User Edit Cells

    Here is an example of writting directly to a FlexGrid - http://www.vbforums.com/showthread.php?t=231160

    You can get more complex by "floating" a textbox sized the same as the cell but its tricky. I have some code to do it if you try a search by my username and probably listview.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    5

    Re: ListView or MSFlexGrid - User Edit Cells

    Cheers RobDog888

    I will have a look.

    Matt

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    5

    Re: ListView or MSFlexGrid - User Edit Cells

    RobDog888 that works a treat, thank you.

    I do have one question though.

    I want to populate all the columns (Apart from one) from a DB and I set it so only one column (Left blank) can be edited/selected be the user.

    I am sure I know how to populate the columns from the DB but I am not sure how to set only one column to user input.

    Thank you in advance.

    Matt

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    5

    Re: ListView or MSFlexGrid - User Edit Cells

    Sorted.

    I took the easy option

    VB Code:
    1. Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
    2.  
    3. If MSFlexGrid1.Col = 1 Then
    4.     With MSFlexGrid1
    5.         Select Case KeyAscii
    6.             Case 8
    7.                 If Not .Text = "" Then
    8.                     .Text = Left(.Text, Len(.Text) - 1)
    9.                 End If
    10.             Case 9 ' Tab
    11.                If .Col + 1 = .Cols Then
    12.                   .Col = 0
    13.                  If .Row + 1 = .Rows Then
    14.                        .Row = 0
    15.                    Else
    16.                         .Row = .Row + 1
    17.                     End If
    18.                 Else
    19.                     .Col = .Col + 1
    20.                 End If
    21.             Case Else
    22.                 .Text = .Text & Chr(KeyAscii)
    23.         End Select
    24.     End With
    25.  
    26. End If
    27.  
    28. End Sub

    Thanks again Rob

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