Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Append a new item to MsFlexGrid

Posted on 1999-01-26
7
Medium Priority
?
464 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 30 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

722 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