MSFlexGrid control and displaying numeric values

Hi

I am having a strange problem with the MSFlexGrid control when trying
to display numeric values.

"123"     Does NOT get displayed

",123"    Does get displayed


Can anyone explain why this is happening and how to rectify the problem
either with MSFlexGrid or maybe its me :-)

Thanks in advance
LittlePerson

LittlePersonAsked:
Who is Participating?
 
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
I have just searched my MSDN and found the following
Q196833

From that I downlaoded the EditGrid.ext from the MS site.
I have added in OnInitDlg
m_grid.SetTextMatrix(1, 1, "123");//and other values

All display correctly.

It looks like you have a problem with your flexgrid control itself.
0
 
pescateraCommented:
Which version of visual c++ are yuo using? I use de .Net and canĀ“t use de msflexgrid, how could you use it? I am asked to license the control
0
 
pescateraCommented:
Sorry, o forgot to ask you how did you insert the data into the grid. I used the same grid in visual basic, and used to insert numerical values using the .textarray, and formating the number with format number in order to display it properly.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
AndyAinscowFreelance programmer / ConsultantCommented:
What happens with 12 or 1234 or even 123.4?  It looks like it is trying to format with the thousands separator but getting it wrong.
0
 
LittlePersonAuthor Commented:
Hi Andy

All values are in String representation. so "12", "1234" and "123.4" do not get displayed. If I
prefix a non numeric character to any of these it gets displayed fine.

hmmm



LittlePerson

0
 
AndyAinscowFreelance programmer / ConsultantCommented:
I've not used the flexgris but that sounds like it expects a string for displaying.  
You say "12" etc do not get displayed.  How are you filling the cells.
0
 
LittlePersonAuthor Commented:
SetTextMatrix(row,col, either CString or LPCTSTR)
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Do you mean

double d = 123.4;
CString s;
s.Format("f.2", d); //s="123.4"
SetTextMatrix(rwo, col, s);

doesn't display anything?

Could you post your code for the original 123 appearing as ,123 please.
0
 
LittlePersonAuthor Commented:
I have tried a couple of ways

m_dataGrid.SetTextMatrix(1,1, _T("123.000"));

CString str = "123";
m_dataGrid.SetTextMatrix(1,1, str);

m_dataGrid.SetTextMatrix(1,1, "123");

None get shown in the grid!

Cheers
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
But
m_dataGrid.SetTextMatrix(1,1, "a123");
does get shown?
0
 
LittlePersonAuthor Commented:
Thanks Andy

I'll look into that asap.

Cheers
0
All Courses

From novice to tech pro — start learning today.