Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++comboboxForms
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 15: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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 450
1 Sergey Alexandrovich Kryukov 350
2 Shai Vashdi 318
3 OriginalGriff 265
4 Peter Leow 171
0 Sergey Alexandrovich Kryukov 9,109
1 OriginalGriff 5,290
2 Peter Leow 4,010
3 Maciej Los 3,535
4 Abhinav S 3,263


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 23 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid