Click here to Skip to main content
11,496,146 members (777 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: C++ combobox Forms
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 23-Apr-13 16:48pm
Comments
Sergey Alexandrovich Kryukov at 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
  Permalink  

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

  Print Answers RSS
0 Dnyaneshwar@Pune 692
1 RyanDev 230
2 CHill60 163
3 Sascha Lefèvre 145
4 Sergey Alexandrovich Kryukov 124
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 23 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100