Author Topic: VS 2008 C# Form Dropdown box Question.  (Read 12147 times)

0 Members and 1 Guest are viewing this topic.

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
VS 2008 C# Form Dropdown box Question.
« on: March 03, 2010, 10:22:02 PM »
+1
Okay so I have a dropdown box with two options.  Option1 and Option2.

I also have a control grid for each which is by default hidden unless the choose one of the two options.

If they choose option1, option1controls will appear.

If they choose option 2, option2controls will appear.

My question is, how do I set it to do that?  I highlight the dropdown list control, filter through all the options and cant seem to find the property stings I have in the list.  Or a way that if this one is selected, show this control if this one is selected show the other.

Secondly, I need a directory selection path, for the uo client files.  I have tried every control there is in VS2k8 forms and cant seem to find this one.

Finally anyone got a good site with documentation and "how to" with regards to forms?
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: VS 2008 C# Form Dropdown box Question.
« Reply #1 on: March 04, 2010, 03:48:40 AM »
+1
You'll spend a lot of time at MSDN looking through the docs.  :)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline draxxter

  • Jr. Member
  • **
  • Posts: 38
  • Activity:
    0%
  • Reputation Power: 0
  • draxxter has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #2 on: March 04, 2010, 05:31:06 AM »
+1
Well i guess you mean DropDownList control. Then you need to hook your code in SelectedIndexChanged Event to hide/show the Grids.
With controlid.SelectedItem you get the ListItem, with controlid.SelectedValue you get the Item Value, etc etc.
Also you will need to have the grid for option 1 visible by default since option 1 will be already selected since you have only 2 options.
A work around is to add another item as a dummy something like "Nothing Selected...".


Not sure i got the selection path part of your question.


Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: VS 2008 C# Form Dropdown box Question.
« Reply #3 on: March 05, 2010, 12:58:36 PM »
+1
It's all going to be done in the .cs file that is attached to that form.

Something along of the lines of:

Code: [Select]
if Dropdownboxid.option[0] == true
{
controls1id.visible = true;
}
if Dropdownboxid.option[1] == true
{
controls2id.visible = true;
}

that's not exact code since I don't know the exact id's of what you're doing, but it will look similar to that
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #4 on: March 05, 2010, 01:03:49 PM »
+1
It's all going to be done in the .cs file that is attached to that form.

Something along of the lines of:

Code: [Select]
if Dropdownboxid.option[0] == true
{
controls1id.visible = true;
}
if Dropdownboxid.option[1] == true
{
controls2id.visible = true;
}

that's not exact code since I don't know the exact id's of what you're doing, but it will look similar to that

AH HA!  That is exactly what I needed.  If it dont work I will post, but thank you!!!  U DA MAN!
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #5 on: March 05, 2010, 01:13:49 PM »
+1
Dont forget to set the control not to be seen  visible property to false.

Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #6 on: March 05, 2010, 01:15:47 PM »
+1
Well didnt seem to work, this is what I put in, probably wrong syntax or wrong area...

Code: [Select]
       private void comboBoxResourceBot_SelectedIndexChanged(object sender, EventArgs e)

        {
            if comboBoxResourceBot.option[1] == true
            {
                groupBoxLumber.visable = true;
            }
        }
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #7 on: March 05, 2010, 01:18:51 PM »
+1
If I can just figure out how to make things appear and disappear when other things are checked, be it drop own, radio or checkbox I can finish this menu.

Can anyone send me a source for a single form, with a drop down menu like that, and a control that will appear and disappear?

basicly have dropdown box with two options...

Show
Hide

And have even a pic appear, I dont care waht the object is, as long as I get an example lol.
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: VS 2008 C# Form Dropdown box Question.
« Reply #8 on: March 05, 2010, 01:29:37 PM »
+1
First off, let VS auto-complete for you. If it doesn't bring up what you want, then you have the wrong syntax.

In this case, it should be ".Visible" not ".visable" There could be more problems with it than that though
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #10 on: March 05, 2010, 01:30:46 PM »
+1
I think what I am doing wrong here is I am adding items to the drop down list, however, no variables of said items?  Possibly?
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #11 on: March 05, 2010, 01:32:53 PM »
+1
Okay that link explains that, need to mess around mroe I think.  And I caught the spelling error...
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #12 on: March 05, 2010, 01:46:41 PM »
+1
Okay here is my test form.

It has a drop down list with "Show" and "Hide" in the list along with a labeled "Layout Panel" Set to hide.  So when show is selected, I need to make that panel show.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
TestForm.zip
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline draxxter

  • Jr. Member
  • **
  • Posts: 38
  • Activity:
    0%
  • Reputation Power: 0
  • draxxter has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #13 on: March 08, 2010, 12:17:58 AM »
+1
Code: [Select]
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((string) comboBox1.SelectedItem == "Hide")
            {
                label1.Visible = false;
            }
            if ((string) comboBox1.SelectedItem == "Show")
            {
                label1.Visible = true;
            }
        }

Also assign the event in design mode or in Form constructor with
Code: [Select]
comboBox1.SelectedIndexChanged+=comboBox1_SelectedIndexChanged;

Hope i helped.

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: VS 2008 C# Form Dropdown box Question.
« Reply #14 on: March 08, 2010, 05:37:24 AM »
+1
Thanks Draxxter, UOOMD helped me with this, but we used numbers 0-9 ect instead of the words of the selection, I didnt know you could do that.  Good to know, thank you.  You must know C# pretty well huh?
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Tags: