Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSHFLEX Grid - multiple line per Row??! Pls Help

Status
Not open for further replies.

Fori

Programmer
Jun 18, 2003
84
MT
Hi all

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!!

How can this be done!

Thanks
Nick
 
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.
 
i need a more sofisticated version if possible! but still thanks for sharing your idea ZOR!!
Tahnks
Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top