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. ListBox control

ListBox control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
6 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.
  • K Offline
    K Offline
    Kiethnt
    wrote on last edited by
    #1

    Sorry I confused some where. so let me post this massage again. Any body kwown please show me how to use List Controlfor in my case that is explained as following: In my dialog, I created two ListBox1 and ListBox2 with multiline and 1 button Send. So when I push button send the String ar row 1 form ListBox1 will be send to ListBox2, that means the string in row 1 of List control 1 will be disappeared and insert to row 1 of ListBox2, the sequence is run step by step up to there is no string in ListBox1 Thank very much.

    N N H 3 Replies Last reply
    0
    • K Kiethnt

      Sorry I confused some where. so let me post this massage again. Any body kwown please show me how to use List Controlfor in my case that is explained as following: In my dialog, I created two ListBox1 and ListBox2 with multiline and 1 button Send. So when I push button send the String ar row 1 form ListBox1 will be send to ListBox2, that means the string in row 1 of List control 1 will be disappeared and insert to row 1 of ListBox2, the sequence is run step by step up to there is no string in ListBox1 Thank very much.

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      Kiethnt wrote:

      Sorry I confused some where. so let me post this massage again.

      Why don't you modify your previous post?


      Nibu thomas A Developer Programming tips[^]  My site[^]

      1 Reply Last reply
      0
      • K Kiethnt

        Sorry I confused some where. so let me post this massage again. Any body kwown please show me how to use List Controlfor in my case that is explained as following: In my dialog, I created two ListBox1 and ListBox2 with multiline and 1 button Send. So when I push button send the String ar row 1 form ListBox1 will be send to ListBox2, that means the string in row 1 of List control 1 will be disappeared and insert to row 1 of ListBox2, the sequence is run step by step up to there is no string in ListBox1 Thank very much.

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #3

        try following code. if( ListBox1.GetCount() > 0 ) { CString csText; ListBox1.GetText( 0, csText ); ListBox2.AddString( csText ); ListBox1.DeleteString( 0 ); } where ListBox1 is the control variable for the listbox 1 and ListBox2 is the control variabale for the listbox 2.

        nave

        K 1 Reply Last reply
        0
        • K Kiethnt

          Sorry I confused some where. so let me post this massage again. Any body kwown please show me how to use List Controlfor in my case that is explained as following: In my dialog, I created two ListBox1 and ListBox2 with multiline and 1 button Send. So when I push button send the String ar row 1 form ListBox1 will be send to ListBox2, that means the string in row 1 of List control 1 will be disappeared and insert to row 1 of ListBox2, the sequence is run step by step up to there is no string in ListBox1 Thank very much.

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

          Can you show your code how do you use of it


          WhiteSky


          1 Reply Last reply
          0
          • N Naveen

            try following code. if( ListBox1.GetCount() > 0 ) { CString csText; ListBox1.GetText( 0, csText ); ListBox2.AddString( csText ); ListBox1.DeleteString( 0 ); } where ListBox1 is the control variable for the listbox 1 and ListBox2 is the control variabale for the listbox 2.

            nave

            K Offline
            K Offline
            Kiethnt
            wrote on last edited by
            #5

            My program had run already, I really thank for your help Naveen R. However, the problem here is I want the string will be send continuosly when I push Send button once only. One more question I would like ask you that how to write all string in a Listbox control to file .txt and read string in text file to Listbox control. Please help me solve this problem.

            N 1 Reply Last reply
            0
            • K Kiethnt

              My program had run already, I really thank for your help Naveen R. However, the problem here is I want the string will be send continuosly when I push Send button once only. One more question I would like ask you that how to write all string in a Listbox control to file .txt and read string in text file to Listbox control. Please help me solve this problem.

              N Offline
              N Offline
              Naveen
              wrote on last edited by
              #6

              CStdioFile File; File.Open( _T("C:\\listboxdata.dat"), CFile::modeCreate|CFile::modeWrite ); int nCount = m_list.GetCount(); for( int nIdx =0;nIdx< nCount;nIdx++ ) { CString csText; m_list.GetText( nIdx, csText ); File.WriteString( csText ); } File.Close(); Do the reverse for reading...

              nave

              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