Home arrow C++ arrow Page 2 - Programming MSFlexGrid in MFC (VC++)

Programming MSFlexGrid in MFC (VC++)

Representation of data is one the central aspects of any application. Tabular representation of data is the most common method of representing given data. Each language/framework provides its own technique, in the form of controls, to present data in tabular format. MFC (Microsoft Foundation Classes) is no exception. One of the controls that it provides is the MSFlexGrid control.

Author Info:
By: A.P.Rajshekhar
Rating: 5 stars5 stars5 stars5 stars5 stars / 10
January 28, 2009
  1. · Programming MSFlexGrid in MFC (VC++)
  2. · Using MSFlexGrid: Step by Step
  3. · MSFlexGrid in the Real World
  4. · More Code

print this article

Programming MSFlexGrid in MFC (VC++) - Using MSFlexGrid: Step by Step
(Page 2 of 4 )

The following are the steps required to use MSFlexGrid in an application.

1. Including MSFlexGrid in the project.

2. Setting up the properties of the MSFlexGrid.

3. Declaring an MSFlexGrid variable and using it.

Of these, the first step is divided into different sub-steps. 

Including MSFlexGrid in the project

Since FlexGrid is also an ActiveX control, the steps to include it in a project are the same as for adding any other ActiveX control. First, you must open the Components and Controls dialog by selecting it from the Add To Project sub-menu of Project menu. The dialog box that comes up contains all the ActiveX controls that can be added to the current project.

Next, in the dialog box, select "Registered ActiveX Controls." From the new list that appears, select "Microsoft Hierarchical FlexGrid Control." Click on the Insert button to add the control to the current project. The added control will appear in the resource editor's Controls toolbar.

If the control needs to be used as part of a dialog (which is usually the case), perform the steps for adding the controls to a dialog.

Setting up the properties of the MSFlexGrid

The next step is to set up the properties of the FlexGrid. The easiest way is to use the Properties Page to change the default properties to the required values. The other way is to do it programmatically. However, to do so, a declaration of a variable corresponding to the FlexGrid is needed.

Declaring MSFlexGrid variable and using it

Using the "Add Member Variable," add a variable for FlexGrid. This variable can be used to either change the properties of the FlexGrid or to call the FlexGrid's methods. For example, if the name of the declared variable is m_Edit_Grid, then one would clear the existing values in the FlexGrid by calling the clear method. The statement would be:


That completes the second section. The next section will focus on a small application that will use the MSFlexGrid control.

blog comments powered by Disqus

- Intel Threading Building Blocks
- Threading Building Blocks with C++
- Video Memory Programming in Text Mode
- More Tricks to Gain Speed in Programming Con...
- Easy and Efficient Programming for Contests
- Preparing For Programming Contests
- Programming Contests: Why Bother?
- Polymorphism in C++
- Overview of Virtual Functions
- Inheritance in C++
- Extending the Basic Streams in C++
- Using Stringstreams in C++
- Custom Stream Manipulation in C++
- General Stream Manipulation in C++
- Serialize Your Class into Streams in C++

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials