2011-10-27 32 views
0

ダイアログにdatagridviewを挿入します。System.windows.forms.datagridviewをダイアログに挿入するにはどうすればよいですか?

私はこれを加えた後、15のエラーが発生しました。どうしてこれなの?

ここはコードです。

// AccessDlg.h : header file 
// 

#pragma once 
#include "stdafx.h" 

// CAccessDlg dialog 
class CAccessDlg : public CDialog 
{ 
// Construction 
public: 
    CAccessDlg(CWnd* pParent = NULL); // standard constructor 

// Dialog Data 
    enum { IDD = IDD_ACCESS_DIALOG }; 

    protected: 
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 

    CWinFormsControl<System::Windows::Forms::DataGridView> m_DataGridView; 

// Implementation 
protected: 
    HICON m_hIcon; 

    // Generated message map functions 
    virtual BOOL OnInitDialog(); 
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam); 
    afx_msg void OnPaint(); 
    afx_msg HCURSOR OnQueryDragIcon(); 
    DECLARE_MESSAGE_MAP() 
}; 

void CAccessDlg::DoDataExchange(CDataExchange* pDX) 
{ 
    CDialog::DoDataExchange(pDX); 
    DDX_ManagedControl(pDX, IDC_GridView, m_DataGridView); 
} 

エラーは次のようなものです。

error C2143: syntax error : missing ';' before '<' 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C3083: 'Windows': the symbol to the left of a '::' must be a type 
error C3083: 'Forms': the symbol to the left of a '::' must be a type 
error C2039: 'DataGridView' : is not a member of 'System' 
error C2238: unexpected token(s) preceding 

答えて

0

あなたはafxwinforms.hを含めていますか?あなたはstdafx.hに以下を追加してください。

#include <afxwinforms.h> 
関連する問題