Solved

Grid text entry

Posted on 2002-05-07
5
326 Views
Last Modified: 2012-06-27
I have an MSFlexgrid which is not only used to display text from a "spreadsheet" but should also allow the user to edit a cell.

The .Text property lets me access the data, but there's no real interface to get data in.

I tried overlaying a textbox, but the cell size is too small and the textbox won't resize that small without changing the font.  It also doesn't easily scroll when the grid scrolls.

I've tried using the KeyPress event, but it leaves the user without a cursor.

Has anyone else dealt with data entry into a flexgrid?  How have you handled these issues?
0
Comment
Question by:rspahitz
[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
5 Comments
 
LVL 7

Expert Comment

by:Joe_Griffith
ID: 6994886
I have been successful using a text box on top of the cell to be edited.  It's not easy however, and to really make it work smoothly you have to write a fair amout of pretty complicated code.

I've never had any trouble with the cell size and the size of the text box.  Make sure you turn off the text box's border.  It should then easily fit in the cell.

Scrolling is the major problem and requires repositioning the text box with every movement.  My application only requires vertical scrolling and I have been able to make it work fairly well.

There are other grids available that avoid the whole problem but they have their own set of problems.  The reason I stayed with a kludge of the flex grid was to have complete control of the tab and shift tab key strokes.
0
 
LVL 18

Expert Comment

by:mdougan
ID: 6994893
Well, the real answer is to pony-up the cash and buy the full version of the flexgrid from VideoSoft (now called ComponentOne at www.componentone.com).  The MS Flexgrid is a lite version of the VS Flexgrid Pro v7.0.  The Pro version has the capability of editing directly in the grid.  It's a really great grid, so, I'd highly recommend it if you are going to be developing applications that use grids.

Now, in many cases, buying a $700 grid is not an option.  So, in that case, you might want to consider using the Excel technique, where when the user clicks on a Cell, you might highlight that cell, but then force them to enter the data in a textbox at the top of the form.  Clicking Enter or a button with a checkmark on it next to the textbox would cause the text from the textbox to be entered programmatically into the cell.

If the Cell Height and Width are large enough (I'm not sure if the MS FlexGrid supports User Resizing or not), then you could use the trick of positioning the textbox over the Cell in those cases.
0
 
LVL 4

Accepted Solution

by:
ckosloski earned 100 total points
ID: 6994930
Here is the code that I used for editing and tabing in a MSFlexGrid.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q241355
0
 
LVL 22

Author Comment

by:rspahitz
ID: 6995015
Thanks, Joe, mdougan and ckosloski.

I addressed the scrolling issue by simply hiding the textbox when it loses focus (e.g. the user scrolls on the grid.)  And as you guessed, I'm not ready to spend $700 on a new grid control since it's only a single use on a remote form.

The MS reference was actually pretty good, and I got some good ideas from it.

I was mainly wondering if I had missed something obvious (like a property called "EnableEdit") and it seems that I didn't.

Thanks.
0
 
LVL 22

Author Comment

by:rspahitz
ID: 6995018
Oh, yeah, the reason I got the height problem was that I wanted the border on (but 3D off) so the user could more easily tell where the cursor was located.  When you do that, it goes slightly below the standard grid cell height.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

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 …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

691 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