Cannot get mshflexgrid to reconize events

I have done this many times in the past:eg
in fact a lot of the code is copied from past projects
Make the mshflexgrd editable by placing a textbox over the selected cell
but for some reason I can not get the grid to recognize events:

The grid 2nd column(1)
The textbox to edit cells:(txtEdit)
What could be causing the mshgrid to not fire events ?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
The event is probably being absorbed by the textbox, if that's the cell you are clicking.
isnoend2001Author Commented:
What i don't understand is why this has never happened before
Martin LissOlder than dirtCommented:
So you want the underlying grid to respond to the click? If so, why, and maybe I could be of more help if you uploaded your project.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

isnoend2001Author Commented:
Thanks Martin Liss
I thought i attached the project. If not i will again
Martin LissOlder than dirtCommented:
You did. I just overlooked it and I'll download it now.
isnoend2001Author Commented:
good, thanks
Martin LissOlder than dirtCommented:
What are the steps necessary to reproduce the problem?
Martin LissOlder than dirtCommented:
Also I don't know what event in the grid that you want to have happen when the textbox is clicked, but your floating textbox is not behaving properly in that it's carrying over values from the previous cell. I've attached a demo floating textbox project and maybe if you compare the two you can see what you aren't doing correctly.
isnoend2001Author Commented:
If typed into the last column the typed text will be entered into the selected cell and the textbox cleared
When entering a new cell the contents of the grid are entered into the textbox and can be edited or deleted.
i have used this method on many grids in the past, never ran into this problem before
Martin LissOlder than dirtCommented:
OK but as I said your floating textbox is not working properly and I think if you fix that then the other problem will go away.
isnoend2001Author Commented:
I will check your zip.
I know the action needs tweaking.But
Cannot tweak until the grid recognizes events eg
Martin LissOlder than dirtCommented:
My demo does does that so again I suggest that you need to fix your textbox code.
isnoend2001Author Commented:
I suggest that you need to fix your textbox code.
what is the the problem ?
I notice you code puts the typed text into the cell, but if the cell contains text it is not put into the textbox.
Martin LissOlder than dirtCommented:
In my code add lines 27 to 29.
Sub MSFlexGridEdit(MSFlexGrid As Control, Edt As Control, KeyAscii As Integer)

    ' This only happens for the 1st character entered.
    ' The other characters are typed into txtEdit.
    ' Use the character that was typed.
    Select Case KeyAscii

    ' A space means edit the current text.
    Case 0 To 32
        Edt = MSFlexGrid
        Edt.SelStart = 1000

    ' Anything else means replace the current text.
    Case Else
        Edt = Chr(KeyAscii)
        Edt.SelStart = 1
    End Select

    ' Show Edt at the right place.
    Edt.Move grdFloat.Left + MSFlexGrid.CellLeft, MSFlexGrid.CellTop + MSFlexGrid.Top, _
        MSFlexGrid.CellWidth, MSFlexGrid.CellHeight
    Edt.Visible = True

    If Edt.Text = "" Then
        Edt.Text = MSFlexGrid.Text
    End If

    ' And let it work.
End Sub

Open in new window

isnoend2001Author Commented:
Thanks Martin Liss seems you want to change the way my code works This could be a good thing with a little tweaking. Eg; color cell or textbox upon entering cell and put cell text into textbox,
This way a user can tell the cell can be typed.
I still do not know why these events don't fire:
Martin LissOlder than dirtCommented:
Most likely they don't fire because the text box is in the way. I'm away from home but if you can wait until morning I'll have your project fixed up.
isnoend2001Author Commented:
Thanks MartinLiss got plenty to do other than that. I can wait
Martin LissOlder than dirtCommented:
Try this. All the changes I made are marked with 'new

Also just a suggestion but when you zip up a project don't include the vbw file since that file is only a record of how your VB6 workspace is set up (window sizes and positions, etc) and if it's not included the recipients workspace set up will be used.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
Thanks MartinLiss that sure fixed my problem
isnoend2001Author Commented:
Hi Martin liss
I noticed that when grid is clicked the color of the heading on Col1 was lost.
I fixed it like this:
 on form load
grid2Column.Row = 1 'added this to stop loosing backcolor of heading(light yellow)
  grid2Column.Col = 0
would this be correct ?
isnoend2001Author Commented:
Hi Martin Liss I looked at a past project i wrote a couple yrs ago
It contained 19 editable mshflexgrids on many forms. I never had the problem i posted here.
You have provided a fix for this problem, but i remain in the dark as to why, suddenly i had this problem.
Before i posted i tried everything to overcome this issue.
when i post questions I always hope you are the one who answers
Glad you are here
Martin LissOlder than dirtCommented:
You're welcome and that's nice to hear. I'm not at home (again) but when I get a chance I'll try to figure out why your posted project doesn't work.
Martin LissOlder than dirtCommented:
I don't know how your original project worked before but the problem was that on txtEdit LostFocus the contents of txtEdit were being put in the new cell rather than the previous cell where txtEdit used to be. Here's a version with a few small changes.
isnoend2001Author Commented:
Thanks MartinLiss
After looking at your changes I am bewildered as to why the other grids work as good as they do, but they do. I copied-pasted the code from one, must have missed something in the process
Martin LissOlder than dirtCommented:
If you can't figure out why, post one of the projects that works.
isnoend2001Author Commented:
Thanks MartinLiss, but the project is huge with tons of purchased ocx's
Those work correctly and the one you have helped me with works so i am moving on.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.