Solved

Editable Flex Grid

Posted on 2004-09-26
6
1,521 Views
Last Modified: 2013-12-26
1) How to make Flex Grid or Data Grid editable in vb6.Do we have any other editable grid control in vb6.
2) how to embed Excel sheet on any VB form.
0
Comment
Question by:deepu712
[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
6 Comments
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12157879
1) flexgrid cannot be editable .. the other grid provided by microsoft is datagrid
2) what do u mean by embed .. do u just want to open and display an excel sheet .. u could look at OLE or reference to Excel objects within ur project and use them to open an excel application and ur workbook
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12157918
have a look at this link provided by microsoft .. shows how u could code to make ur flexgrid editable ...
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/KB/ARTICLES/Q85/1/09.asp&NoWebContent=1

there are also some third party controls like sharpgrid, spread control, VSFlexgrid, shridian controls etc which provide good functionalities .. like the one u require and also adding combos, checkbox within cells etc ..
0
 
LVL 11

Accepted Solution

by:
dbrckovi earned 125 total points
ID: 12163054
FlexGrid is not editable by default, but you can use KeyPress event to make it editable.

For example:

'---------------------------------------------------
Private Sub Form_Load()
    MSFlexGrid1.Rows = 5
    MSFlexGrid1.Cols = 5
End Sub

Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
    With MSFlexGrid1
        Print KeyAscii
   
        If KeyAscii = 8 And Len(.Text) > 0 Then .Text = Left(.Text, Len(.Text) - 1)
       
        If KeyAscii >= 32 And KeyAscii <= 128 Then
            .Text = .Text & Chr(KeyAscii)
        End If
    End With
End Sub
'------------------------------------------------------------
0
Technology Partners: 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 11

Expert Comment

by:Steiner
ID: 12190636
Cool thing dbrckovi, I never thought that making a flexgrid editable would be that easy...
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12192624
Well yes, it's easy to create basic edit functions, but some things are still not possible as far as I know.

For example, I never managed to create blinking cursor, or find an easy way to edit middle of the text in a cell.

Another possibility would be to do the Excell-style editing. For example, create a textbox next to the flexgrid and keep it updated with the contents of the selected cell.
In textbox's Change event, update the selected cell.

'-------------------------------------

To embed an excell sheet on your form just create WebBrowser control (Project -> Components -> Microsoft Internet Controls)
and use it's Navigate function:

WebBrowser1.Navigate "d:\download\rosenthal.xls"
0
 
LVL 9

Expert Comment

by:dancebert
ID: 12201440
Many developers have written wrappers or templates for flexgrid to make it editable.  This is the one I use.  It's object-oriented and allows input validation on a column-by-column basis.

http://www.a1vbcode.com/app.asp?ID=2281
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

756 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