Solved

MS FLEXGRID ADDITEM METHOD

Posted on 1998-08-12
3
1,219 Views
Last Modified: 2008-02-01
I AM HAVING PROBLEMS PASSING THE SECOND PARAMETER (INDEX) TO THE FLEXGRID ADDITEM METHOD.
IN VB5 IT IS AN OPTIONAL PARAMETER. HOW SHOULD I PASS IT IN VC++? WHERE CAN I FIND DOCUMENTION ABOUT USING THIS ACTIVE X CONTROL WITH MS VISUAL C++?
0
Comment
Question by:AGUILAR
  • 2
3 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1170155
When you open the Components and Controls Gallery and select Microsoft FlexGrid Control, press the More Info button to open the help file.
0
 
LVL 2

Accepted Solution

by:
jrmcg earned 50 total points
ID: 1170156
All of the documentation for the MSFlexGrid that I have been able to find has been for Visual Basic.  AddItem inserts a row at a given index (you supply).  If you want to add a row to the end of the grid, make the call like this -

m_Grid.AddItem("Column0Text\tColumn1Text\tColumn2Text",m_GridControl.GetRows());

Tabs inside the string separate the text by column.

m_GridControl is a control variable of type CMSFlexGrid,
usually I just use the wizard to create this.
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1170157
Correction to the proposed answer:

The parameter is supposed to be of type const struct tagVARIANT &
You can look this structure up in the help files.
Proper usage would be this

// Declare a variable of type tagVARIANT
tagVARIANT RowIndexToAdd;

RowIndexToAdd.vt = VT_I4;       // variable is a 4-byte integer type
RowIndex.lVal = m_Grid.GetRows();     // Gets next row, will increase # of rows
                                                         // You can insert whichever row you want to add

// Now make call to AddItem passing the tagVARIANT
m_Grid.AddItem(csFormattedString, RowIndexToAdd);
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting IP address 8 81
IdTCPClient1->Disconnect(); not working 3 67
Least Squares Curve Fitting 4 81
Create a path if not exists 7 78
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

821 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