?
Solved

Please help me asap! Combo Box + List Control Error

Posted on 2003-10-30
1
Medium Priority
?
186 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
[X]
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
1 Comment
 
LVL 8

Accepted Solution

by:
martynjpearson earned 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

764 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