Solved

MS FLEXGRID ADDITEM METHOD

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

730 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