Reading from Comboboxes on a datagrid view (C++/CLI - Windows Forms App in VS2008) [modified]
-
I have my filtered combo boxes working in a datagridview thanks to a Linda Liu sample. Now when I enter a row I want to see the data from a row in a sequence of text boxes below the grid - but for the combo boxes I only see the index, when I would prefer to see the information e.g. route description. Here is a cutdown version of From1.h:
namespace DataGridViewComboEx5 {
using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Collections::Generic; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::IO; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::DataGridView^ gridPassenger; private: System::Windows::Forms::DataGridViewComboBoxColumn^ dgRoute; private: System::Windows::Forms::DataGridViewComboBoxColumn^ dgStage; private: System::Windows::Forms::DataGridViewTextBoxColumn^ dgPerson; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Label^ lblPerson; private: System::Windows::Forms::Label^ lblStage; private: System::Windows::Forms::Label^ label3; private: System::Windows::Forms::Label^ lblRoute; private: System::Windows::Forms::Label^ label5;
:
:ref class ViewPassengerData
{
private:
int m_Route;
int m_Stage;
String ^m_Person;
public:
ViewPassengerData(int Route, int Stage, String^ Person)
{
m_Route = Route;
m_Stage = Stage;
m_Person = gcnew String(Person);
}
property int RouteID
{
int get()
{
return m_Route;
}
void set(int value)
{
m_Route = value;
}
}
property int StageID
{
int get()
{
return m_Stage;
}
void set(int value)
{
m_Stage = value;
}
}
property String^ Person
{
String^ get()
{
return m_Person;
}
void set(String^ value)
{
m_Person = value;
}
}
};
private:
List<ViewPassengerData^> ^m_DataList;
DataSet ^RouteStages;
DataTable ^dtRoute;
DataTable ^dtStages;
BindingSource ^bsRoute;
BindingSource ^childBS;
BindingSource ^filteredStages;
bool m_LoadComplete;private: System:
-
I have my filtered combo boxes working in a datagridview thanks to a Linda Liu sample. Now when I enter a row I want to see the data from a row in a sequence of text boxes below the grid - but for the combo boxes I only see the index, when I would prefer to see the information e.g. route description. Here is a cutdown version of From1.h:
namespace DataGridViewComboEx5 {
using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Collections::Generic; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::IO; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::DataGridView^ gridPassenger; private: System::Windows::Forms::DataGridViewComboBoxColumn^ dgRoute; private: System::Windows::Forms::DataGridViewComboBoxColumn^ dgStage; private: System::Windows::Forms::DataGridViewTextBoxColumn^ dgPerson; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Label^ lblPerson; private: System::Windows::Forms::Label^ lblStage; private: System::Windows::Forms::Label^ label3; private: System::Windows::Forms::Label^ lblRoute; private: System::Windows::Forms::Label^ label5;
:
:ref class ViewPassengerData
{
private:
int m_Route;
int m_Stage;
String ^m_Person;
public:
ViewPassengerData(int Route, int Stage, String^ Person)
{
m_Route = Route;
m_Stage = Stage;
m_Person = gcnew String(Person);
}
property int RouteID
{
int get()
{
return m_Route;
}
void set(int value)
{
m_Route = value;
}
}
property int StageID
{
int get()
{
return m_Stage;
}
void set(int value)
{
m_Stage = value;
}
}
property String^ Person
{
String^ get()
{
return m_Person;
}
void set(String^ value)
{
m_Person = value;
}
}
};
private:
List<ViewPassengerData^> ^m_DataList;
DataSet ^RouteStages;
DataTable ^dtRoute;
DataTable ^dtStages;
BindingSource ^bsRoute;
BindingSource ^childBS;
BindingSource ^filteredStages;
bool m_LoadComplete;private: System:
When you have code like this, please wrap the block of code in a <pre> </pre> tags. It makes it easier to read.
-
When you have code like this, please wrap the block of code in a <pre> </pre> tags. It makes it easier to read.
Done - wasn't aware of them - and I've chopped out much of the autogenerated code. Ger
Ger
-
Done - wasn't aware of them - and I've chopped out much of the autogenerated code. Ger
Ger