Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
I have an existing VS2008 MFC application that I need to add user functionality to. The cleanest way to do this is with a DataGrid form of some sort. Since the DataGridView control is not in the toolbox I tried this Microsoft method:
http://msdn.microsoft.com/en-us/library/b1kyh79x.aspx

The article says I should select WindowsFormsControlLibrary1 for the reference. However, when I click on the Projects tab there is nothing there. I searched the hard drive and the WindowsFormsControlLibrary1.dll file is not on my machine.

All I need is a simple 5 col X 20 row form for the user to enter data. Are there any alternative ways to accomplish this? Or any way to get the DataGrid control into my MFC application?

Ray
Posted

The article also says, that you must create the WindowsFormsControlLibrary1.dll as first step. If you can't find the dll then this means you didn't follow the first steps "To create the .NET user control". It is all very good explained - just follow the instructions step by step.
 
Share this answer
 
Comments
Dalek Dave 28-Oct-10 17:49pm    
Good Call.
JF2015,

Thanks for the input. I had completely ignored the .NET process. When I saw that my mind said I'm working with MFC. :sigh:

So I followed the .NET procedure. It created the WindowsFormsControlLibrary1.dll. I then followed the MFC steps. But I still do not see anything underneath the Projects tab. I added the path to the dll in the Reference Search Path window.

So I am getting closer but still not there.

One other question: Once I get this working will my project still compile with all the MFC code in it?

Thanks.
 
Share this answer
 
I have an article from a few years back that shows how you can add the MenuStrip/ToolStrip controls to an MFC app :

http://www.codeproject.com/KB/miscctrl/MfcWinFormsOff.aspx[^]

The same techniques should work a DataGridView too.
 
Share this answer
 
I finally got it working. Since there was nothing under the Projects tab I clicked browse, traversed to where the WindowsFormsControlLibrary1.dll file was, selected that and then clicked OK. Next I clicked Apply and OK on the Properties Page.

I then added all the MFC code shown in the article into the .ccp and .h files. Next I compiled the code and ran the application. The DataGridView control is shown as expected.

I am giving credit to JF2015 since he pointed me in the right direction.

Ray
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900