Click here to Skip to main content
15,921,226 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: W2A query Pin
[James Pullicino]30-May-02 1:38
[James Pullicino]30-May-02 1:38 
GeneralRe: W2A query Pin
Michael Dunn30-May-02 5:28
sitebuilderMichael Dunn30-May-02 5:28 
GeneralRe: W2A query Pin
Nish Nishant30-May-02 15:00
sitebuilderNish Nishant30-May-02 15:00 
GeneralVC++ timer and multithreading problems Pin
29-May-02 21:11
suss29-May-02 21:11 
GeneralRe: VC++ timer and multithreading problems Pin
KarstenK29-May-02 23:26
mveKarstenK29-May-02 23:26 
GeneralData Transfer - Help!!! Pin
Sameer Maggon29-May-02 20:29
Sameer Maggon29-May-02 20:29 
GeneralRe: Data Transfer - Help!!! Pin
Ed Gadziemski30-May-02 11:25
professionalEd Gadziemski30-May-02 11:25 
GeneralSorting Pin
29-May-02 19:42
suss29-May-02 19:42 
I need to sort some data in a flex grid and seem to be having some trouble. I have the Row/Column fixed data finished, but when I try placing data into the other fields it becomes all eratic as some data is left out and other data is repeated. If anyone would take a look at my code and give me an idea of what I am doing wrong I'd REALLY appreciate it. The work I am doing requires me to use the FlexGrid.
My code is listed below.

Thanks in advance,
Garry

void CFGridDlg::LoadData()
{
//Get the grid row count
int liCount;
//Initialize the random number generator
srand((unsigned)time(NULL));
//Create and array
for (liCount = m_ctlFGrid.GetFixedRows();
liCount < m_ctlFGrid.GetRows(); liCount++)
{

//Generate the first Column (Jan) values
//m_ctlFGrid.SetTextArray(GenID(liCount, 0), StringValue(1));
//Generate the second column (Jan) values
m_ctlFGrid.SetTextArray(GenID(liCount, 1), StringValue(1));
//Generate the third column (Feb) values
m_ctlFGrid.SetTextArray(GenID(liCount, 2), StringValue(1));
//Generate the fourth column (Mar) values
m_ctlFGrid.SetTextArray(GenID(liCount, 3), StringValue(1));
//Generate the fifth column (Apr) values
m_ctlFGrid.SetTextArray(GenID(liCount, 4), StringValue(1));
//Generate the sixth column (May) values
m_ctlFGrid.SetTextArray(GenID(liCount, 5), StringValue(1));
//Generate the seventh colummn (Jun) values
m_ctlFGrid.SetTextArray(GenID(liCount, 6), StringValue(1));
DoSort();
}
}

int CFGridDlg::GenID(int m_iRow, int m_iCol)
{
//Get number of columns
int liCols = m_ctlFGrid.GetCols();
//Generate ID's. based on number of Rows, the current row, and the current column
return (m_iCol + liCols * m_iRow);
}

CString CFGridDlg::StringValue(int m_iColumn)
{
//The return Str.
CString reStr;
//Random Value ID
int raCase;
//Set the selection to column 1
//m_ctlFGrid.SetCol(1);

{
//Generate random val.
raCase = (rand() % 5);
//What val was generated?
switch (raCase)
{
case 0: //Rent
reStr = "$650.00";
break;
case 1: //Insurance
reStr = "$259.00";
break;
case 2: //Utilities
reStr = "$130.00";
break;
case 3: //Car payment
reStr = "$220.00";
break;
case 4: //Loans
reStr = "$60.00";
break;
default: //Credit cards
reStr = "$30.00";
break;
}
}
return reStr;
}

void CFGridDlg::DoSort()
{
//Set the current column to column 1
m_ctlFGrid.SetCol(1);
//Set the selection to all columns
m_ctlFGrid.SetColSel((m_ctlFGrid.GetCols() - 1));
//Ascending sort
m_ctlFGrid.SetSort(0);
}
QuestionHow does CAsyncSocket start it's notification loop? Pin
29-May-02 18:41
suss29-May-02 18:41 
AnswerRe: How does CAsyncSocket start it's notification loop? Pin
Joaquín M López Muñoz29-May-02 19:53
Joaquín M López Muñoz29-May-02 19:53 
GeneralRe: Thx (How does CAsyncSocket start it's notification loop?) Pin
29-May-02 20:30
suss29-May-02 20:30 
GeneralCListCtrl Overlay Images. Pin
myfriendofmisery29-May-02 18:40
myfriendofmisery29-May-02 18:40 
GeneralRe: CListCtrl Overlay Images. Pin
Shog929-May-02 19:30
sitebuilderShog929-May-02 19:30 
GeneralTAPI Pin
Sameer Maggon29-May-02 18:34
Sameer Maggon29-May-02 18:34 
GeneralRe: TAPI Pin
Michael P Butler29-May-02 22:01
Michael P Butler29-May-02 22:01 
GeneralMessage Queue and Threads Pin
wilche29-May-02 17:51
wilche29-May-02 17:51 
GeneralRe: Message Queue and Threads Pin
Prem Kumar29-May-02 18:28
Prem Kumar29-May-02 18:28 
GeneralRe: Message Queue and Threads Pin
wilche30-May-02 13:52
wilche30-May-02 13:52 
GeneralRe: Message Queue and Threads Pin
Bill Wilson30-May-02 12:12
Bill Wilson30-May-02 12:12 
GeneralRe: Message Queue and Threads Pin
wilche30-May-02 13:48
wilche30-May-02 13:48 
GeneralPassing Pointer Between DLL & App Pin
29-May-02 17:08
suss29-May-02 17:08 
GeneralRe: Passing Pointer Between DLL & App Pin
Joaquín M López Muñoz29-May-02 19:47
Joaquín M López Muñoz29-May-02 19:47 
GeneralRe: Passing Pointer Between DLL & App Pin
29-May-02 21:09
suss29-May-02 21:09 
GeneralRe: Passing Pointer Between DLL & App Pin
29-May-02 21:14
suss29-May-02 21:14 
GeneralRe: Passing Pointer Between DLL & App Pin
29-May-02 21:35
suss29-May-02 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.