VC++ 6.0 question newbie question
-
I have a CListBox in which I display a string using the AddString function For the CString I use it's Format Function CListBox List1; CString str; short Data[50]; int DataSize ; /* variable */ DataSize = /*some processing */ for ( i=0;i<j;i++) { /* some other processing*/ str.Format("%X ",Data[i]); List1.AddString(str); } My current code Data is outputed in this manner 05 25 6F E2 I want my display to be like this : Contents of Data[DataSize-1] Contents of Data[DataSize-2] .... Data[0] e.g if Data[0]= 05 Data[1]= 25 Data[2]=6F and Data[3]= E2 Display I want is E2 6F 25 05 (ie in the same line ) How do I go about doing it ? any help woould be appreciated
Use AppendFormat() in place of Format(). And Addstring to the list when you complete the line. And Are you expecting data in separate column?
-
Use AppendFormat() in place of Format(). And Addstring to the list when you complete the line. And Are you expecting data in separate column?
Is AppendFormat present CString Function in VC++ 6.0 ?
-
Is AppendFormat present CString Function in VC++ 6.0 ?
Are you expecting data in separate column?
-
Use AppendFormat() in place of Format(). And Addstring to the list when you complete the line. And Are you expecting data in separate column?
I want data to displayed like this 25 4E 20 F6 .... (for example) and not like this 25 4E 20 F6 ( I dont want for it to displayed in Different rows but all in the same row)
-
I want data to displayed like this 25 4E 20 F6 .... (for example) and not like this 25 4E 20 F6 ( I dont want for it to displayed in Different rows but all in the same row)
Then I am not sure AppendFormat is supported in VS 6.0. But i think it should have concatenation operator. Format using temp variable and concatenate to main string. If want in separate column go for ListView control, CListCtrl.
-
I have a CListBox in which I display a string using the AddString function For the CString I use it's Format Function CListBox List1; CString str; short Data[50]; int DataSize ; /* variable */ DataSize = /*some processing */ for ( i=0;i<j;i++) { /* some other processing*/ str.Format("%X ",Data[i]); List1.AddString(str); } My current code Data is outputed in this manner 05 25 6F E2 I want my display to be like this : Contents of Data[DataSize-1] Contents of Data[DataSize-2] .... Data[0] e.g if Data[0]= 05 Data[1]= 25 Data[2]=6F and Data[3]= E2 Display I want is E2 6F 25 05 (ie in the same line ) How do I go about doing it ? any help woould be appreciated
You can concatenate all hex. digits in one string. As shown below: CString strLine; for ( i=0;i { /* some other processing*/ str.Format("%X ",Data[i]); strLine += str; } List1.AddString(strLine); In this approach, you can also use tab ('\t') separator char. between numbers, then you can use CListBox::SetTabStops() function in order to display it properly. If you want to have real tabular view, you can employ CListCtrl (list view control) instead of CListBox.
-
I have a CListBox in which I display a string using the AddString function For the CString I use it's Format Function CListBox List1; CString str; short Data[50]; int DataSize ; /* variable */ DataSize = /*some processing */ for ( i=0;i<j;i++) { /* some other processing*/ str.Format("%X ",Data[i]); List1.AddString(str); } My current code Data is outputed in this manner 05 25 6F E2 I want my display to be like this : Contents of Data[DataSize-1] Contents of Data[DataSize-2] .... Data[0] e.g if Data[0]= 05 Data[1]= 25 Data[2]=6F and Data[3]= E2 Display I want is E2 6F 25 05 (ie in the same line ) How do I go about doing it ? any help woould be appreciated
it's because you're using a List control, and you're setting each string on a line. you have to build the single string, and do the List1.AddString() after the for() loop...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
it's because you're using a List control, and you're setting each string on a line. you have to build the single string, and do the List1.AddString() after the for() loop...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
toxcct wrote:
it's because you're using a List control...
How did you infer this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
toxcct wrote:
it's because you're using a List control...
How did you infer this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
DavidCrow wrote:
How did you infer this?
List1.AddString() is explicit enough...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
You can concatenate all hex. digits in one string. As shown below: CString strLine; for ( i=0;i { /* some other processing*/ str.Format("%X ",Data[i]); strLine += str; } List1.AddString(strLine); In this approach, you can also use tab ('\t') separator char. between numbers, then you can use CListBox::SetTabStops() function in order to display it properly. If you want to have real tabular view, you can employ CListCtrl (list view control) instead of CListBox.
thanks that does it I am new to C++
-
DavidCrow wrote:
How did you infer this?
List1.AddString() is explicit enough...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
Isn't
Addstring()
for listboxes?"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Isn't
Addstring()
for listboxes?"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
DavidCrow wrote:
Isn't Addstring() for listboxes?
and what did I say ? i said *a* List *Control*, not meaning CListCtrl in particular, but a control which managed datas as a list...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]