listbox

Listbox generates secondary Listbox based on selection

自闭症网瘾萝莉.ら 提交于 2019-12-08 12:50:05
问题 I'm still pretty new to VBA, but I have two activex listboxes on a worksheet. On one listbox I have salesperson names (called lstNames) and the other listbox has locations (lstSite). What I'm trying to achieve is the following: Select name from lstNames Selection from lstNames generates lstSite with a list of a few locations associated with the name. For example, if I select Bob from the lstNames listbox, then the lstSites listbox will populate all of Bob's sites like NY, CO, CA, PA. If I

Asp.net updatepanel Listbox not refreshing layout

我与影子孤独终老i 提交于 2019-12-08 12:32:57
问题 so my problem is fairly simple i have 2 list-boxes and one button. when an item is selected in listbox2 and the button is clicked i would like to add the selected item to listbox1. And it all seams to work until I add the second item. then listbox1 doesn't refresh it's items... <body> <form id="form1" runat="server"> <asp:ScriptManager runat="server"></asp:ScriptManager> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:ListBox ID="ListBox1" runat="server"></asp

Read the Value of an Item in a listbox

情到浓时终转凉″ 提交于 2019-12-08 12:00:44
问题 I'm developing a small windows store application in C# where I have populated the values and content for a listbox using the following code snippet. code 1 : adds the song title as a item to a listbox , using the Song class to create the item private void addTitles(string title, int value) { Song songItem = new Song(); songItem.Text = title; songItem.Value = value; listbox1.Items.Add(songItem); // adds the 'songItem' as an Item to listbox } code 2 : Song class which is used to set values to

Bootstrap Dual Listbox : How to Limit Selected Option

你。 提交于 2019-12-08 11:50:23
问题 I'm using Bootstrap Dual Listbox to help user choose some option. You can see I have add the plugin on my project. It's success. But i got a problem when try to make a limit when user choose the option. Example: There are some option, like: Apple Mango Orange Melon Guava User must choose 3 option. You can't choose 1,2,4, or 5. The problem is about to limit the option can be choose. By default, the user is not limited to choose. This is some of my code: <script src="<?php echo $baseurl; ?

How to get indices of multiple item that were selected in listbox

£可爱£侵袭症+ 提交于 2019-12-08 11:42:19
问题 I want to get indices of all the items that are selected in given listbox, there is a SelectedItems method which return a collection of items: listbox.SelectedItems But there is no SelectedIndices method. The collection also doesn't contain an index for each item. How can I know which item was selected in my listbox? 回答1: You can simply use IndexOf to find their index in the collection of items. For example, when binding a collection of items: // create your list of items to display List

C# WPF ViewModel for a class with List

只谈情不闲聊 提交于 2019-12-08 11:03:06
问题 I have a class with a list of items, something like this: public class Model{ List<int> Items { get; set; } } It uses List, not ObservableCollection, and doesn't have any events to be subscribed to. I need to make a ListBox oneway-bound to this list and a way to remove items one-by-one. So I must write a ViewModel class, a property of which can be oneway-bound to ListBox to show these items and to update the ListBox when the list is changed with RemoveItem method. I don't know how to oneway

Silverlight how to promote selected item of listbox when using buttons within datatemplates

人盡茶涼 提交于 2019-12-08 10:28:07
问题 Within a Listbox control I have a Data Template which consists of text and a button. Given the nature of Silverlight/WPF when I click on the button within the listbox item the button event is trapped before the listbox item is selected. Therefore if I am trying to pass the record ID of the selected listbox item I am currently only able to do so by first clicking and selecting the listbox item and then clicking on the button. Is there a way to promote the selection of the listbox item so that

Can't get listed of selected items from multiselect ListBox in Excel userform

无人久伴 提交于 2019-12-08 09:37:00
问题 New to VBA and having some difficulty getting selected items from a ListBox. I keep getting an error on the For line. The name of the ListBox is correct and I think .ListCount should work. Sub GetListBox1() Dim SelectedItems As String For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected = True Then SelectedItems = SelectedItems & ListBox1.List(i) End If Next i Debug.Print SelectedItems End Sub 回答1: Try the code below, switch "UserForm1" with the name of your form. Dim SelectedItems As

WPF Style Triggers: can I apply the one style for a variety of Properties?

独自空忆成欢 提交于 2019-12-08 07:57:55
问题 It seems like there has to be a way to do this: I am applying an ItemContainerStyle in my Listbox, based on two property triggers. As you can see, I'm using the exact same set of trigger enter/exit actions, simply applied on two different properties. Is there something equivalent to a <Trigger Property="prop1" OR Property="prop2"> ??? (Obviously wouldn't look like that, but that probably gets the point across.) <Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem"> <Style.Triggers>

ASP.NET Populate a listbox without a postback

自闭症网瘾萝莉.ら 提交于 2019-12-08 07:44:44
问题 I have a simple aspx page with a textbox, linkbutton and listbox. The listbox is to be populated with values from a stored procedure in a SQL database. What I'd like to do, somehow, is to populate the listbox with those variables when the user clicks the linkbutton. Ideally, I'd like to do this WITHOUT a postback. Is there any way this can be accomplished? Thanks, Jason 回答1: I mocked one up for you really quickly. <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat=