Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I make a FlexGrid editable???

Posted on 2000-04-06
7
Medium Priority
?
188 Views
Last Modified: 2010-05-02
Hi,

I'm using the following code to create and populate a felxgrid with information from an Access DB. Can anyone please tell me how to edit the code in order to make the Grid editable. i.e I want to be able to update the info in the Db Table from my form.

Any help or suggestions would be greatly appreciated.
cheers,
ian


Set rs1 = New adodb.Recordset        'create recordset
    rs1.Open "select * from AdministratorPasswords", conn, adOpenKeyset,     adLockOptimistic                             'populate rs with query result


mfgFlex1.Clear 'set grid layout at run-time
    k = rs1.RecordCount
    j = rs1.Fields.Count
    mfgFlex1.Rows = k + 1
    mfgFlex1.Cols = j + 1
   
    With mfgFlex1
        lngRow = 1
        Do Until rs1.EOF
            mfgFlex1.TextMatrix(0, 1) = "Username"
            mfgFlex1.TextMatrix(0, 2) = "Password"
            For lngCol = 0 To rs1.Fields.Count - 1
                .TextMatrix(lngRow, lngCol + 1) = rs1(lngCol)
            Next lngCol
            rs1.MoveNext
            lngRow = lngRow + 1
        Loop
    End With
0
Comment
Question by:shovels
[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
7 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2690506
you will need to create an invisible textbox that moves to the desired cell location and becomes visible when you want to edit the grid
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2690510
rather than post all the code just see this article:
http://msdn.microsoft.com/library/techart/msdn_msflexgrid.htm

cheers!
0
 
LVL 6

Expert Comment

by:Marine
ID: 2690716
as another person mantioned, flexgrid is read-only by default therefore you cannot edit it. You can get around it by placing the textbox into each cell when you click in it. And depending on the cell you click you would place a textbox in there.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:Nazdor
ID: 2692487
Try using a DataGrid instead.

Add an ADO datasource, assign the DataGrid to it, load the datasource's recordset accordingly (which auto loads into the datagrid).  You can lock columns you don't want people to edit etc.

However, I've found it a bit clunky... :-(  So you're probably better off dealing with the extra code and sticking with your flexgrid...
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 2692708
Hi!

The various grids are quite poor in VB from a user edit perspective.

Upgrade to TrueDBGrid is a good start!

I usually Pop up Record Edit forms by clicking an Edit button - allowing edit of the Selected record and close control of what the user is doing.

With the datagrids selecting a record moves the record so its easy to edit the underlying record.

Editing in the grid is clunky and difficult for the user (my opinion only!) nad difficult to control.

Good Luck

Voodoman!


0
 
LVL 1

Accepted Solution

by:
mr_krishna earned 100 total points
ID: 2693468
Put a TextBox control in the form and write the following code. There is no other way to make flexigrid is editable.

With flexgrid1
      If .Col = 2 And .Row <> .Rows - 1 Then
         bCellEdit = True
         txtCell.Top = .Top + .CellTop - 50
         txtCell.Left = .Left + .CellLeft - 50
         txtCell.Height = .CellHeight
         txtCell.Width = .CellWidth + 30
         iLastRow = .Row
         txtCell = .Text
         txtCell.Visible = True
         txtCell.SetFocus
      End If
   End With
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2693528
mr krishna that is what my link tells him, in detail the procedure to use that method
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

596 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