Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. tab control error"illegal use of this type as an expression"

tab control error"illegal use of this type as an expression"

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
5 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vc programmer 0
    wrote on last edited by
    #1

    My application is MDI application. So,I cannot know what parameter use in following code??? m_tabPages[0]->Create(CMyTabDlg,this); >>>>>>>>>>>>>>>This is my error>>>>>>>>>>>>>> MyTabCtrl.cpp(54) : error C2275: 'CMyTabDlg' : illegal use of this type as an expression MyTabdlg.h(13) : see declaration of CMyTabDlg' >>>>>>>>>>>>>>>This is My code>>>>>>>>>>>>>>>> //MyTabCtrl.cpp CDialog *m_tabPages[2]; //MyTabCtrl.cpp void CMyTabCtrl::Init() { m_tabCurrent=0; m_tabPages[0]->Create(CMyTabDlg,this); //what i use parameter m_tabPages[1]->Create(CMyTabDlg,this); //what i use parameter m_tabPages[0]->ShowWindow(SW_SHOW); m_tabPages[1]->ShowWindow(SW_HIDE); SetRectangle(); } //MyView.h CMyTabCtrl m_tab; //MyView.cpp void CMyView::OnInitialUpdate() { CFormView::OnInitialUpdate(); m_tab.InsertItem(0, _T("One")); m_tab.InsertItem(1, _T("Two")); m_tab.Init(); }

    N 1 Reply Last reply
    0
    • V vc programmer 0

      My application is MDI application. So,I cannot know what parameter use in following code??? m_tabPages[0]->Create(CMyTabDlg,this); >>>>>>>>>>>>>>>This is my error>>>>>>>>>>>>>> MyTabCtrl.cpp(54) : error C2275: 'CMyTabDlg' : illegal use of this type as an expression MyTabdlg.h(13) : see declaration of CMyTabDlg' >>>>>>>>>>>>>>>This is My code>>>>>>>>>>>>>>>> //MyTabCtrl.cpp CDialog *m_tabPages[2]; //MyTabCtrl.cpp void CMyTabCtrl::Init() { m_tabCurrent=0; m_tabPages[0]->Create(CMyTabDlg,this); //what i use parameter m_tabPages[1]->Create(CMyTabDlg,this); //what i use parameter m_tabPages[0]->ShowWindow(SW_SHOW); m_tabPages[1]->ShowWindow(SW_HIDE); SetRectangle(); } //MyView.h CMyTabCtrl m_tab; //MyView.cpp void CMyView::OnInitialUpdate() { CFormView::OnInitialUpdate(); m_tab.InsertItem(0, _T("One")); m_tab.InsertItem(1, _T("Two")); m_tab.Init(); }

      N Offline
      N Offline
      nguyenvhn
      wrote on last edited by
      #2

      As I thought, CMyTabDlg was a class name, not variable name, so that, it is illegal to appear as a function argument.

      V 1 Reply Last reply
      0
      • N nguyenvhn

        As I thought, CMyTabDlg was a class name, not variable name, so that, it is illegal to appear as a function argument.

        V Offline
        V Offline
        vc programmer 0
        wrote on last edited by
        #3

        //CMyTab //MyTab.h CDialog *m_tabPages[2]; //MyTab.cpp m_tabPages[0]->Create(CMyTabDlg,this); My demo is MDI application. i have a class.This is CMyTabCtrl, i found codeproject web site. this demo is dialog base application. i run this demo is ok. and i making mdi application. and use this class. but i don't know.what parameter place in "CWnd* pParentWnd". >>>>>m_tabPages[0]->Create(CMyTabDlg,this); >>>>>function argument(CDialog::Create) BOOL Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL );

        N 1 Reply Last reply
        0
        • V vc programmer 0

          //CMyTab //MyTab.h CDialog *m_tabPages[2]; //MyTab.cpp m_tabPages[0]->Create(CMyTabDlg,this); My demo is MDI application. i have a class.This is CMyTabCtrl, i found codeproject web site. this demo is dialog base application. i run this demo is ok. and i making mdi application. and use this class. but i don't know.what parameter place in "CWnd* pParentWnd". >>>>>m_tabPages[0]->Create(CMyTabDlg,this); >>>>>function argument(CDialog::Create) BOOL Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL );

          N Offline
          N Offline
          nguyenvhn
          wrote on last edited by
          #4

          BOOL Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL ); In this case, the first argument typed string?

          V 1 Reply Last reply
          0
          • N nguyenvhn

            BOOL Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL ); In this case, the first argument typed string?

            V Offline
            V Offline
            vc programmer 0
            wrote on last edited by
            #5

            Yes!!! i change................. m_tabPages[0]->Create(IDD_MY_DLG,this); thank you so much...........

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups