[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Grid text entry

Posted on 2002-05-07
5
Medium Priority
?
331 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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 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