cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Skilled Sharer
Skilled Sharer

Set Combobox Value

This should be simple.  I have a combobox (ClientContactCB) with a list of names.  One name is Ted Bell.  I have a variable, varClientContact = "Ted Bell".  I want to set the value of the combobox to the value of the variable "Ted Bell".

12 REPLIES 12
Highlighted
Microsoft
Microsoft

Re: Set Combobox Value

Hello mogulman,

What do you mean by "set the value fo the combobox"? Do you mean:

1. Changing the value of one of the ComboBox items?

2. Selecting that item in ComboBox?

 

For #1, you would have to change tha value on the source (form which the ComboBox is getting data)

For #2 For example:

Button1.OnSelect=Reset(ClientContactCB);Set(d, [varClientContact ])

ClientContactCB.DefaultSelectedItems=d

 

Clicking on Button1 should select the item from the variable varClientContact

Highlighted
Frequent Visitor

Re: Set Combobox Value

I guess I'm not explaining myself very well. But I finally figured out problem.  DefaultSelectedItems expects a table.  Simply put square brackets around it to cast as table [varClientContact].  After I figured it out I looked dinusc's solution and noticed square brackets.  Wasted 2 hours on this.

 

Cast2Table.png

 

 

Highlighted
Microsoft
Microsoft

Re: Set Combobox Value

I'm glad you figured it out. Please note that the reason you need square brackets is because the DefaultSelectedItems can have more that one item.

Highlighted
Post Prodigy
Post Prodigy

Re: Set Combobox Value

Hi

 

How do I set the DefaultSelectedItems to the item the user has selected from the drop down ?

 

Regards

 

Nigel

Highlighted
Post Prodigy
Post Prodigy

Re: Set Combobox Value

Hi

 

I have tried this abd I get an error for combobox.DefaultSelectedItems saying that DefaultSlectedItems is an invalid name !

 

Anybody Any ideas ?

 

Regards

 

Nigel

Highlighted
Skilled Sharer
Skilled Sharer

Re: Set Combobox Value

How do I set the DefaultSelectedItems to the item the user has selected from the drop down ?

 

 I'm not understanding your question.  Do you have Dropdown and a Combobox?

 

To get value of Combobox selection use this:

 

Last(ClientContactCB.SelectedItems).FullName

ClientContactCB is the combobox.  FullName is the field in the combobox.  If this is not what you want post specific details on your question.

 

 

 

 

Highlighted
Post Prodigy
Post Prodigy

Re: Set Combobox Value

Hi Mogulman

 

I am trying to set a value for a combobox when a user selects a item from the dropdown.

 

Thanks

 

Nigel

Highlighted
Microsoft
Microsoft

Re: Set Combobox Value

Hello Nigel,

 

The following should work for default ComboBox1 and DropDown1 controls:

DropDown1.OnSelect=Reset(ComboBox1);Set(dsi,Dropdown1.Selected.Value)

ComboBox1.DefaultSelectedItems=[dsi]

Highlighted
Post Prodigy
Post Prodigy

Re: Set Combobox Value

Hi dinusc

 

This almost worked !

 

The selected value flashes up for a moment before "Find Items" overwrites it.

 

Regards

 

Nigel

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,601)