We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Hi…
I have question regarding the use of ComboBoxes on a UserForm in a Keyword test. I have a “Department” ComboBox that is populated with the following… “Dariy”, “Frozen”, “Grocery”…etc. I would like to have a second ComboBox that displays the warehouses associated with the departments – basically the “Warehouse” ComboBox is pre-filtered based on the department selected, thus limiting the User’s Warehouse selection to only the warehouses that service the previously selected department.
If user selects department “Dairy”, the Warehouse ComboBox displays: “Warehouse 100”, “Warehouse 200”
If user selects department “Frozen”, the Warehouse ComboBox displays “Warehouse120”, “Warehouse 220”
If user selects department “Grocery”, the Warehouse ComboBox displays “Warehouse 110”, “Warehouse 210”.
I think you get the idea.
Is this even possible in a keyword test using the Items property (or any other property for that matter) of the ComboBoxes?
Thank you in advance for your time!
Dave.
Add the Clear method at the beginning of the OnChange event handler to clear the list of Warehouse combobox. Here is my code:
function UserForm1_cxComboBox2_OnChange(Sender)
{
UserForms.UserForm1.cxComboBox1.Properties.Items.Clear();
if (UserForms.UserForm1.cxComboBox2.Text == "Frozen")
{
with (UserForms.UserForm1.cxComboBox1.Properties.Items)
{
Add("100-Warehouse 100");
Add("200-Warehouse 200");
}
}
if (UserForms.UserForm1.cxComboBox2.Text == "Dairy")
{
with (UserForms.UserForm1.cxComboBox1.Properties.Items)
{
Add("110-Warehouse 110");
Add("210-Warehouse 210");
}
}
}
Does it help?
Hi Dave,
You can activate http://smartbear.com/viewarticle/72063/ for the first combobox and fill in the second combobox from this event handler. Please refer to the following page that contains a sample of how to populate a TcxComboBox component at run time: https://support.smartbear.com/viewarticle/74601/
Hi,
You need to call Add inside with. The with operator allows you to define an object where Add will belong. Take a look at your script where you fill in the combobox based on Dairy.