Hi Everyon.

Sorry to bother you all again.

but I cant seem to figure out a solution for comparing information in these comboBoxes. What I want it to do is take the information the user selects and compare it with another drop down.

so lets say one drop down says Terran and a second one says Noxious. I want the second Combobox to check what it says inside it, (i can get this to work then i add a veriable to it) then i want it to check if the first Combebox says Terran if so check if one of the selection boxes(i have 6 textboxes that have the same input) already has the same information.

then later on i add it to the calculation at the end. but my problem is trying to compare infermation from the other comboboxes. before i was kinda just looking at the info in one combie box. now i want to compare info from one box and determine weather the other box is aloud that selection. If that makes any sence

here is some of the code i got so far.

//veribales needed to do all the calculations and storing
		float gravholder;
		float tempholder;
		float atmosholder;
		int calevelholder;
		int calcholder;
		int cacalc;
		int addonholder;
		int addonholder2;
		int addonholder3;
		int addonholder4;
		int addonholder5;
		int addonholder6;

private: System::Void checkedListBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void addonBox5_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void Gravity_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 String^ gravtextholder = this->Gravity->Text;
			 if (gravtextholder == "Heavy")
			 {
				 gravholder = 0.5;
			 }
			 if (gravtextholder == "Low")
			 {
				gravholder = 0.75;
			 }
			 if (gravtextholder == "Normal")
			 {
				gravholder = 1;
			 }

			 if (Calc->CanFocus){
				 Calc->Focus();
			 }
		 }
private: System::Void Atmos_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 String^ atmostextholder = this->Atmos->Text;
			 if (atmostextholder == "Gaseous")
			 {
				 atmosholder = 0.5;
			 }
			 if (atmostextholder == "Noxious")
			 {
			     atmosholder = 0.75;
			 }
			 if (atmostextholder == "Terran")
			 {
				 atmosholder = 1;
			 }
			 if (Calc->CanFocus){
				 Calc->Focus();
			 }
		 }
private: System::Void Temp_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 String^ temptextholder = this->Temp->Text;
			 if (temptextholder == "Blistering")
			 {
				 tempholder = 0.5;
			 }
			 if (temptextholder == "Frozen")
			 {
				 tempholder = 0.75;
			 }
			 if (temptextholder == "Temperate")
			 {
				 tempholder = 1;
			 }
			 if (Calc->CanFocus){
				 Calc->Focus();
			 }
		 }
private: System::Void CAinput_TextChanged(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void Calc_Click(System::Object^  sender, System::EventArgs^  e) {
			 String^ addonbox3 = this->addonBox3->Text;
			 
				 if (addonbox3 == "Atmosphere Scrubbing") {
					 addonholder3 = 5;
				 }

				 if (addonbox3 == "Atmosphere Cleansing") {
						 addonholder3 = 15;
				 }
				 if (addonbox3 == "Atmosphere Scraping") {
						 addonholder3 = 25;
				 }
			 Calculation();
		 }
private: System::Void basicViewToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void shipFittingToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void baseCalculatorToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void Calculation() {
			 calcholder = (gravholder*atmosholder*tempholder)*100;
			 cacalc = (((calevelholder*0.05)*calcholder)+calcholder)+addonholder3;
			 if (cacalc > 125) {
				 cacalc = 125;
			 }
			 this->inputText->Text = cacalc.ToString() + "%";
		 }
private: System::Void CAinput_KeyDown(System::Object^  sender, System::Windows::Forms::KeyEventArgs^  e) {
			 if (e->KeyCode == Keys::Enter){
				 Calculation();
			 }
			 if (this->CAinput->Focus()){
				 if (this->CAinput->Text == "Enter your CA Level"){
					 this->CAinput->Text = "";
				 }
			 }
			 else {
				 this->CAinput->Text = "Enter your CA Level";
			 }
			 
			 if (e->KeyCode == Keys::Back) {
				 int store;
				 if (this->CAinput->Text->Length > 0) {
					 store = this->CAinput->Text->Length;
					 this->CAinput->Text = this->CAinput->Text->Remove(store -1, 1);
				 }
			 }
			 if (e->KeyCode == Keys::D0) {
				 this->CAinput->Text += "0";
			 }
			 if (e->KeyCode == Keys::D1) {
				 this->CAinput->Text += "1";
			 }
			 if (e->KeyCode == Keys::D2) {
				 this->CAinput->Text += "2";
			 }
			 if (e->KeyCode == Keys::D3) {
				 this->CAinput->Text += "3";
			 }
			 if (e->KeyCode == Keys::D4) {
				 this->CAinput->Text += "4";
			 }
			 if (e->KeyCode == Keys::D5) {
				 this->CAinput->Text += "5";
			 }
			 if (e->KeyCode == Keys::D6) {
				 this->CAinput->Text += "6";
			 }
			 if (e->KeyCode == Keys::D7) {
				 this->CAinput->Text += "7";
			 }
			 if (e->KeyCode == Keys::D8) {
				 this->CAinput->Text += "8";
			 }
			 if (e->KeyCode == Keys::D9) {
				 this->CAinput->Text += "9";
			 }
			 if (e->KeyCode == Keys::NumPad0) {
				 this->CAinput->Text += "0";
			 }
			 if (e->KeyCode == Keys::NumPad1) {
				 this->CAinput->Text += "1";
			 }
			 if (e->KeyCode == Keys::NumPad2) {
				 this->CAinput->Text += "2";
			 }
			 if (e->KeyCode == Keys::NumPad3) {
				 this->CAinput->Text += "3";
			 }
			 if (e->KeyCode == Keys::NumPad4) {
				 this->CAinput->Text += "4";
			 }
			 if (e->KeyCode == Keys::NumPad5) {
				 this->CAinput->Text += "5";
			 }
			 if (e->KeyCode == Keys::NumPad6) {
				 this->CAinput->Text += "6";
			 }
			 if (e->KeyCode == Keys::NumPad7) {
				 this->CAinput->Text += "7";
			 }
			 if (e->KeyCode == Keys::NumPad8) {
				 this->CAinput->Text += "8";
			 }
			 if (e->KeyCode == Keys::NumPad9) {
				 this->CAinput->Text += "9";
			 }
			 if (this->CAinput->Text->Length > 0) {
				calevelholder = System::Convert::ToInt32(this->CAinput->Text);
			 }
			 if (calevelholder > 30) {
				 this->CAinput->Text = "30";
			 }
		 }
private: System::Void CAadvanced_Load(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void howToUseToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 help^ form2 = gcnew help();
			 form2->ShowDialog();
		 }
private: System::Void CAadvanced_Closing(System::Object^  sender, System::Windows::Forms::FormClosingEventArgs^  e) {
			 e->Cancel = true;
			 this->Visible = false;
		 }

if someone can help me ill be greatfull

kind regards,
cgcgames

Recommended Answers

All 4 Replies

Are you trying to make sure that none of the comboboxes have the same value selected or if they have one of the same options for value that another combobox has?

im checking 3 things. to make sure the other 6 boxes dont have the same value selected.its also checking 2 things. one thing is checking the other 6 for information needed for that item. and its also checking the other 3 i have to see what the user input. basicly it dont matter what im trying to do. all i need to know is how to compare information in the comboboxes

i want to compare it somthing like this

if (Atmos == "Noxious")

but i cant do that becuase its its coded in a diffrent section. i just need to know how to compare boxes so one box looks at the other box to see whats in it and if its the wronge information it wont run that.

if(Atmos->SelectedText !=Temp->SelectedText)

doesn't work for it?

If you wanted to do it succinctly you could step through each of the controls on the form, checking to see if it's a combobox, then checking that combobox versus all the other controls. The best way to mark them is to use the Tag property since there's no "is" keyword in C++/CLI like there is in C#.

thats for the help i wast trying a diffrent way ill give that a go now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.