Link to home
Start Free TrialLog in
Avatar of cyseng10
cyseng10

asked on

MSFlexGrid

i success insert data into MSFlexgrid field. but leading space occur for each field. how should i remove the leading space and insert data located in left side.

i use LTRIM function to remove leading spaces but not working.
Avatar of kapil_mohta
kapil_mohta

could u provide the code u r using to insert the data ?

Kapil
Format the field for text only. Will post back later to tell you how you can do this.
Try:
MSFlexgrid.CellAlignment=flexAlignLeftCenter
If that doesn't work, please post the part of the code where you receive the data, and where you insert it into the grid.
Avatar of cyseng10

ASKER

i read data from text file and using Additem function insert data into MSFlexGrid Field.

the data might long. when i insert into field. i can't disply full length of data. how do i apply scrollbar to view full length of data?

the CellAlignment function and convert to text format is not working.
MsFlexgrid.Wordwrap=true
MsFlexgrid.colwidth=Len(text)/2
MsFlexgrid.rowheight=20
This will adjust the size of the cell to two lines (You may have to fine-tune the rowheight property).
You might also want to make checks to see if the 2nd line won't reduce the colwidth from a previous text entry, but basically, that should take care of the display. Note that you can also divide it by 3 lines, etc. Just adjust as desired.
You can also make a variable to test the longest text length being inserted, and in the end adjust the colwidth.
Another possibility is, after testing the longest length being inserted, test it in a switch case statement, and from zero to value x, divide it in 2 lines, from x+1 to y, divide in 3, etc... Again, adjust as you desire.

Now, about the text part, it would be better if you could post the code for getting the text from the file, and for putting into the MSFlexgrid. That way, we could see how you are doing it, correct any possible mistakes along the way, and get a better understanding of how it works. If you could post a sample of the text file as well, it would be helpful (just a few lines should be enough).
Please closed the question as found solution by myself.

thank you for replying.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial