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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Ctrl List Box

Ctrl List Box

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
21 Posts 4 Posters 0 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.
  • H Hamid Taebi

    Thanks:)_**


    **_

    whitesky


    V Offline
    V Offline
    VinayCool
    wrote on last edited by
    #12

    Hi WhiteSky, one more dout i want to store the date & time in the 4th col how to do that ?? how to access the current time and date and store it in a variable and pass it to col 6th ?? lvi.mask = LVIF_TEXT; lvi.iItem = 6; lvi.iSubItem = 1; lvi.pszText = "16/05/06 4:59 PM"; // In this format only ?? m_INDEX_INFO_LIST.SetItem(&lvi);

    H 1 Reply Last reply
    0
    • V VinayCool

      Hi WhiteSky, one more dout i want to store the date & time in the 4th col how to do that ?? how to access the current time and date and store it in a variable and pass it to col 6th ?? lvi.mask = LVIF_TEXT; lvi.iItem = 6; lvi.iSubItem = 1; lvi.pszText = "16/05/06 4:59 PM"; // In this format only ?? m_INDEX_INFO_LIST.SetItem(&lvi);

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #13

      See COleDateTime::GetCurrentTime [^]_**


      **_

      whitesky


      V 1 Reply Last reply
      0
      • H Hamid Taebi

        See COleDateTime::GetCurrentTime [^]_**


        **_

        whitesky


        V Offline
        V Offline
        VinayCool
        wrote on last edited by
        #14

        Hi, I am not getting the solution can u tell me COleDateTime dateTest; dateTest = COleDateTime::GetCurrentTime(); lvi.mask = LVIF_TEXT; lvi.iItem = 6; lvi.iSubItem = 1; lvi.pszText = "16/05/06 4:30 PM"; m_INDEX_INFO_LIST.SetItem(&lvi);

        H 1 Reply Last reply
        0
        • V VinayCool

          Hi, I am not getting the solution can u tell me COleDateTime dateTest; dateTest = COleDateTime::GetCurrentTime(); lvi.mask = LVIF_TEXT; lvi.iItem = 6; lvi.iSubItem = 1; lvi.pszText = "16/05/06 4:30 PM"; m_INDEX_INFO_LIST.SetItem(&lvi);

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #15

          CString str; SYSTEMTIME st; GetLocalTime(&st); str.Format("%d:%d:%d:",st.wHour,st.wMinute,st.wSecond);_**


          **_

          whitesky


          V 1 Reply Last reply
          0
          • H Hamid Taebi

            CString str; SYSTEMTIME st; GetLocalTime(&st); str.Format("%d:%d:%d:",st.wHour,st.wMinute,st.wSecond);_**


            **_

            whitesky


            V Offline
            V Offline
            VinayCool
            wrote on last edited by
            #16

            CString str; SYSTEMTIME st; GetLocalTime(&st); str.Format("%d:%d:%d:",st.wHour,st.wMinute,st.wSecond); lvi.mask = LVIF_TEXT; lvi.iItem = 6; lvi.iSubItem = 1; lvi.pszText = (LPTSTR)str; m_INDEX_INFO_LIST.SetItem(&lvi); Can u please also tell how to pass it to list box ? i tryed the above code its giveing error...

            H D 2 Replies Last reply
            0
            • V VinayCool

              CString str; SYSTEMTIME st; GetLocalTime(&st); str.Format("%d:%d:%d:",st.wHour,st.wMinute,st.wSecond); lvi.mask = LVIF_TEXT; lvi.iItem = 6; lvi.iSubItem = 1; lvi.pszText = (LPTSTR)str; m_INDEX_INFO_LIST.SetItem(&lvi); Can u please also tell how to pass it to list box ? i tryed the above code its giveing error...

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #17

              for insert string to CListBox you need to AddString or InsertString CListBox m_List; m_List.InsertString or m_List.AddString_**


              **_

              whitesky


              1 Reply Last reply
              0
              • V VinayCool

                CString str; SYSTEMTIME st; GetLocalTime(&st); str.Format("%d:%d:%d:",st.wHour,st.wMinute,st.wSecond); lvi.mask = LVIF_TEXT; lvi.iItem = 6; lvi.iSubItem = 1; lvi.pszText = (LPTSTR)str; m_INDEX_INFO_LIST.SetItem(&lvi); Can u please also tell how to pass it to list box ? i tryed the above code its giveing error...

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #18

                vinaycool wrote:

                ...its giveing error...

                Are we supposed to guess what the error is?


                "The largest fire starts but with the smallest spark." - David Crow

                H 1 Reply Last reply
                0
                • V VinayCool

                  Hi, i have a value CString p = flocation; i want to store it in a list box in the 2 col lvi.mask = LVIF_TEXT; lvi.iItem = 0; lvi.iSubItem = 1; lvi.pszText = "value here"; m_INDEX_INFO_LIST.SetItem(&lvi); can anyone tell how to do that ?? i tryed with lvi.pszText = p but its giveing error, can anyone help me with this. Regards, Vinay Charan. -- modified at 6:27 Tuesday 16th May, 2006

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #19

                  vinaycool wrote:

                  lvi.pszText = "value here";

                  Try:

                  lvi.pszText = (LPTSTR) (LPCTSTR) p;

                  vinaycool wrote:

                  ...but its giveing error...

                  So what's the error?


                  "The largest fire starts but with the smallest spark." - David Crow

                  V 1 Reply Last reply
                  0
                  • D David Crow

                    vinaycool wrote:

                    lvi.pszText = "value here";

                    Try:

                    lvi.pszText = (LPTSTR) (LPCTSTR) p;

                    vinaycool wrote:

                    ...but its giveing error...

                    So what's the error?


                    "The largest fire starts but with the smallest spark." - David Crow

                    V Offline
                    V Offline
                    VinayCool
                    wrote on last edited by
                    #20

                    hi, I had used lvi.pszText = (LPTSTR)str; i was getting below error error C2440: 'type cast' : cannot convert from 'class CString' to 'char *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Error executing cl.exe. Creating browse info file... lvi.pszText = (LPTSTR) (LPCTSTR) p; after using the above statment its working proeprly Thanks a lot ....:)

                    1 Reply Last reply
                    0
                    • D David Crow

                      vinaycool wrote:

                      ...its giveing error...

                      Are we supposed to guess what the error is?


                      "The largest fire starts but with the smallest spark." - David Crow

                      H Offline
                      H Offline
                      Hamid Taebi
                      wrote on last edited by
                      #21

                      Hi DavidCrow I wrote how use values but he writes same question:)_**


                      **_

                      whitesky


                      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