i have a mshflexgrid and i would like to have more than one line per row. I'm entering data through a textbox when leaving the text box i would like to accpet the chr(13) as a skip a line!!
Probably better ideas out there, but I would have run a loop through the contents of the textbox after you had finished typing. ie when leaving, before it gets put in the grid. I would have found the Len of the text, after doing a trim to remove trailing space, to have got my loop value. I would increment through the text using Mid$ until I found Chr(13). Having counted as I went through the loop, I could then do relevant subtractions from the Len value to have got a Left$ and a Right$ from the text. Having split the data then post it to the appropriate Row/cells.
However it's a bit primitive, but a guidline. I know once I had problems trying to find Chr(13) in text before, and had to play with looking for Ascii Character within A-Z and numeric to find what I was looking for. However you must have a reason for wanting more than one row per record, could get complicated later when populating the grid from a file. Much cleaner to have 1 Record per Row. Can't you use another cell on the same row? Another way would be to be to use one key when you were finished typing in the textbox, and another key when you had finished typing in the textbox and wanted to go to a cell below.
Thinking about it more, if when typing you press Return, then simply use the KeyPress event to move to the next cell whereupon another textbox would appear for the further text to go in. Do a Keyword search for KeyPress on this site and you will find lots of threads.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.