Solved

Append a new item to MsFlexGrid

Posted on 1999-01-26
7
459 Views
Last Modified: 2013-11-20
How to use AddItem() to append a new line to MsFlexGrid
0
Comment
Question by:wmh
  • 4
  • 2
7 Comments
 

Accepted Solution

by:
darklight earned 10 total points
ID: 1328373
Ive never used AddItem() to add a new line to MSFlexGrid, but I think this should help you ...

Attach a variable to your grid control (eg. m_MyGrid)
Then use the following code to add lines to your grid:

m_MyGrid.SetCol(0);
m_MyGrid.SetRow(0);
m_MyGrid.SetText("My Text String");

m_MyGrid.SetCol(1);
m_MyGrid.SetRow(0);
m_MyGrid.SetText("My Text String 2");

etc etc ...

Dark Light
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1328374
That will only work if the Row/Col already exists.  The format to use for the AddItem is

     void AddItem(LPCTSTR Item, const VARIANT& index);

If you have 4 columns: Name, SSN, Age, Sex (for instance)

CString NewData = "Bill\t123-45-6789\t25\tM";
// each piece of column data is separated by a '\t' tab character
// if you want to append a row to the end then leave the second parameter blank.
// if you want to insert a row inside the grid other than to the end you must use the variant
// structure.

m_MyGrid.AddItem(NewData); // appends data to end (adds a row)

tagVARIANT Index;
Index.vt = VT_I4;// (that is a capital i) this tells the variant to use the long value union member.
Index.lVal = 4;  // or wherever you want to insert the row.

Is that more like what you needed?

Let me know if you need further help..

J.R.
// then
m_MyGrid.AddItem(NewData, Index);
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1328375
If you would like to use my comment then reject the posted answer and I will Post an answer.

J.R.
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 

Author Comment

by:wmh
ID: 1328376
Thank You!!!
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1328377
Whose answer worked?
0
 

Author Comment

by:wmh
ID: 1328378
Thank you jrmcg !
Your answer is wonderful.
It is what I need.
Thank you ! Thank you very much!!!
                             
                                               wmh

0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1328379
In the future, you can reject the answer that was not used, and the person that helped you the most can post their comment as an answer and they can get the points.  In this situation, darklight got the points for my answer, which was posted as a comment.  I really don't mind because I don't worry about points, but there are some experts here that (unfortunately) are more worried about getting points than helping people.

I am glad that I could help you,

J.R.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 163
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 476
Define unique primary key 9 95
Problem to event 3 105
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question