Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Please help me asap! Combo Box + List Control Error

Posted on 2003-10-30
1
182 Views
Last Modified: 2013-11-20
Program Layout:

Cedit = m_strFile   // Prints the path of the file which contains the album (mp3's)
ComboBox = m_ComboBands // A list of bands
List Control = m_MyAlbums // the name of the bands albums
Button1 = Browse
Button2 = Rename
Button3 = Stop

What this program does is... once a file is selected. You then select which band it is on the comb box and then the list control shows the current bands album names, after selecting one you press rename and it renames the mp3's in the selected file.

Since you have an idea of my program. I have been having problems with getting the selection of the combo box to the list control. After compileing my code, i select a 311 and it displays both 311 and Adema. Please help me!

Heres my code.....

void CMp3RenamerDlg::OnSelchangeCombo1()
{
     char nSelection = m_ComboBands.GetCurSel();

     if( nSelection != LB_ERR )
     {
          if( nSelection, "311" )
          {
                                            m_MyAlbums.DeleteAllItems();
                m_MyAlbums.InsertItem(0, _T( "Music" ));
                m_MyAlbums.SetItemText(0,1, "1993");
               m_MyAlbums.InsertItem(0, _T("Self Titled"));
               m_MyAlbums.SetItemText(0,1, _T("1996"));
                 m_MyAlbums.InsertItem(0, _T("Transistor"));
                m_MyAlbums.SetItemText(0,1, _T("1997"));
               m_MyAlbums.InsertItem(0, _T("Live"));
               m_MyAlbums.SetItemText(0,1, _T("1998"));
                m_MyAlbums.InsertItem(0, _T("Soundsystem"));
                m_MyAlbums.SetItemText(0,1, _T("1999"));
               m_MyAlbums.InsertItem(0, _T("Grassroots"));
               m_MyAlbums.SetItemText(0,1, _T("2000"));
                m_MyAlbums.InsertItem(0, _T("From Chaos"));
                m_MyAlbums.SetItemText(0,1, _T("2001"));
               m_MyAlbums.InsertItem(0, _T("Evolver"));
               m_MyAlbums.SetItemText(0,1, _T("2003"));
          }
          if( nSelection, "Adema" )
          {
                                              m_MyAlbums.DeleteAllItems();
               m_MyAlbums.InsertItem(0, _T("Self Titled"));
               m_MyAlbums.SetItemText(0,1, _T("2001"));    
          }
     }
}
0
Comment
Question by:khaotiksociety
1 Comment
 
LVL 8

Accepted Solution

by:
martynjpearson earned 50 total points
ID: 9656091
Your syntax is wrong in the two if statements where you check for "311" and "Adema"

What you need to do is get the text from the combo box for the selected item, and then compare that with the text strings, thus :

if (nSelection != CB_ERR) // Not LB_ERR, although the two are the same thing!
{
   CString strText;
   m_ComboBands.GetLBText(nSelection, strText);

   if (strText == "311")
   {
      // ...
   }
   else if (strText == "Adema")
   {
      // ...
   }
}

Hope this helps
Martyn
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
method notes when mouse over in eclipse 5 87
move a line in eclipse 3 107
My project did see openJDK that I installed. What could be the problem 7 151
wordcount challenge 11 132
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question