Solved

Append a new item to MsFlexGrid

Posted on 1999-01-26
7
462 Views
Last Modified: 2013-11-20
How to use AddItem() to append a new line to MsFlexGrid
0
Comment
Question by:wmh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Percona Monitoring and Management and Grafana

Proactive monitoring is vital to a highly-available environment. We have a quick start guide on Experts Exchange for Grafana users.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

623 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