Solved

MS FLEXGRID ADDITEM METHOD

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

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

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

772 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

11 Experts available now in Live!

Get 1:1 Help Now