Solved

Append a new item to MsFlexGrid

Posted on 1999-01-26
7
455 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now