Solved

Append a new item to MsFlexGrid

Posted on 1999-01-26
7
457 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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