Jump to content
  • Advertisement
Sign in to follow this  

c++ event handler issue

This topic is 4733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so here is the deal. I want it to use an event handler to fill my combo box. When one item is selected in an combo box, I want it to read the subdirectories in a directory, and fill the second combo box. Now, I know how to do DirectoryInfo in my .cpp file, but how would I go about doing this in my header file? I tried adding in the namespace Microsoft::Win32 but that did not do anything.
private: System::Void cPlayerAccounts_SelectedIndexChanged(System::Object *  sender, System::EventArgs *  e)
		 {
			DirectoryInfo* directory = this->tWoWDir->get_Text();
			System::String* dirName = String::Concat(directory, "\\WTF\\Account\\");
			System::String* accountName = this->cPlayerAccounts->GetItemText();
			DirectoryInfo* accountFolder = String::Concat(dirName, accountName);
			if (accountFolder->Exists)
			{
				DirectoryInfo* playerName[] = accountFolder->GetDirectories();
				for (int i = 0; i < playerName->Length; i++)
				{
					this->cPlayerCharacters->Items->Add(playerName);
				}
			}
		 }
[Edited by - PyroBlizzard on June 6, 2005 10:00:57 PM]

Share this post


Link to post
Share on other sites
Advertisement
try changing quote to source or code it looks much better and is actually readable. Im sure someone will attempt to read your code then.

It looks like your trying to use c# code. there is no namespace microsoft or win32. I dont think directoryinfo is a type either. MSDN is your friend

either that or you're using managed c++ if thats the case you should put that in the title because it seems quite different from the win32/c++ code i know.

Share this post


Link to post
Share on other sites
ah, no. Im not using C# code at all. Im using managed c++. If you had noticed, for one the topic states C++, and also I said I know how to do DirectoryInfo in my .cpp file. Its just a thing of im doing this as an event handler, through a header file.

Share this post


Link to post
Share on other sites
My point was managed c++ ISNT c++ they are very different if you would let people know that in your title you could probably get much more relevant replies.

Share this post


Link to post
Share on other sites
Ok, figured it out somewhat. Problem now is, I dont know how to get the newly selected value in combobox a, so that I can make an according change based on combobox b.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!