Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.67/5 (2 votes)
See more:
Hi Guys,

I'm trying to implement some code that uses a Windows Forms that contains a dropdown combobox that is filled with values. These values depict that level of detail i want stuff to be printed to a log (i.e. Critical messages, Error Messages, Debug Messages ec)

I am wondering if there is a way in which to get my C++ class file to READ the value of the COMBOBOX on the windows form?

i.e. comboBox1 = dlCritical.

In the logfile Class:
iDebugLevels = comboBox1.value()? // I know this doesn't actually work but it's just to explain what i'm looking for.

The structure of the file system is as follows:

<pre lang="c++">
main()
{
   Applicatoin::Run(gcnew Form1());
}

public ref class Form1 : public System::Windows::Forms::Form
{
   private: WinIO mWinIO;
   public:
     Form1(void)
     {
         InitializeComponent();
         mWinIO = gcnew WinIO();
      }
      .....
}

WINIO CLASS:
WinIO::WinIO(void)
{
  mLogFile = new LogFile();
}

LOGFILE CLASS:
LogFile::LogFile(void)
{
     OpenLogFile("WINIO_LOGFILE.txt");
     mDebugLevels = comboBox.Value();  //This is where i would like to read in the value of the combo box value from the form.
}
Posted
Comments
Sergey Alexandrovich Kryukov 23-Apr-13 21:56pm    
How about just reading of the MSDN help pages, with proper attention?
—SA

1 solution

You should use the property System.Windows.Forms.ComboBox.Text, which is the value currently presented in the edit area:
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.text.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900