ScriptUO
Casa de TrailMyx => Programming / Operating Systems => Scripting Languages => Topic started by: Coragin on March 03, 2010, 10:22:02 PM
-
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?
-
You'll spend a lot of time at MSDN looking through the docs. :)
-
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.
-
It's all going to be done in the .cs file that is attached to that form.
Something along of the lines of:
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
-
It's all going to be done in the .cs file that is attached to that form.
Something along of the lines of:
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!
-
Dont forget to set the control not to be seen visible property to false.
-
Well didnt seem to work, this is what I put in, probably wrong syntax or wrong area...
private void comboBoxResourceBot_SelectedIndexChanged(object sender, EventArgs e)
{
if comboBoxResourceBot.option[1] == true
{
groupBoxLumber.visable = true;
}
}
-
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.
-
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
-
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.visible.aspx
-
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?
-
Okay that link explains that, need to mess around mroe I think. And I caught the spelling error...
-
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.
-
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
comboBox1.SelectedIndexChanged+=comboBox1_SelectedIndexChanged;
Hope i helped.
-
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?
-
hehe. Web App C# Developer my job description. :) Glad i could help you. :)
-
hehe. Web App C# Developer my job description. :) Glad i could help you. :)
why havent you joined the uoboost project? lol
-
I was tempted but my free time is already limited and my wife would start kicking my butt :P.
-
I was tempted but my free time is already limited and my wife would start kicking my butt :P.
I hear ya. Cept on the wife part ;) rofl But I know how a GF can be
-
Ask if you need anything else, will try to help as always. :)
-
I just made a new post entitled why would microsoft do this. It asks for two examples. ;)