我想将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 :(得分:0)
你是否包括afxwinforms.h?您应该将以下内容添加到stdafx.h
#include <afxwinforms.h>