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
Solved

MS FLEXGRID ADDITEM METHOD

Posted on 1998-08-12
3
1,221 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to convert c++ code to Android App 3 108
How to split this in C++ 4 106
How do I save this device context as a .bmp or a picture of some kind? 2 64
Outlook 13 41
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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

839 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