DataGridView cell format question

  • Thread starter Thread starter Michael A. Covington
  • Start date Start date
M

Michael A. Covington

How can I get excessively long strings in cells to be trimmed

"...like this"

instead of

"like this..."

?

That is, I want the beginning, not the end, of the displayable string to be
trimmed off. Getting it right-aligned is no problem but it still puts "..."
on the right, not the left.

Thanks!
 
Michael,

Well, you aren't being too specific about ^what^ you are using to
generate this format to begin with. I mean, based on what you said, it's as
simple as calling Substring and tacking three periods to the beginning of
the string, but I don't think that is what you want.
 
Nicholas Paldino said:
Michael,

Well, you aren't being too specific about ^what^ you are using to
generate this format to begin with. I mean, based on what you said, it's
as simple as calling Substring and tacking three periods to the beginning
of the string, but I don't think that is what you want.

Right, because it's not in a fixed-pitch font. If it were, that would be
perfect.

When a string is too long for a cell, it gets truncated on the right:
"abracadabra" becomes "abra..." to fit the physical width of the cell.

To my surprise, this remains the case if the cell is right-aligned rather
than left-aligned.

What I wish is that the analogous thing would happen on the left; thus
"...cadbra".

I'm displaying keywords in context, so I want to do things like:

| ...is the time for | all | good citizens to come to the aid... |

with left and right context of the word.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top