listbox

In VBA (in Excel), differentiating between a listbox changing programatically vs. on click

放肆的年华 提交于 2019-12-13 08:25:41
问题 I have two multi select listboxes in a userform in VBA in Excel. One contains countries, the other contains cities. If the user clicks and selects/deselects a country, I would like my script to automatically select/deselect all of the cities located in that country in the second listbox. Equally, I would like that if the user clicks and selects/deselects a city, it automatically updates the first listbox to highlight only countries for which all of their corresponding cities are currently

How can I assign enum values to a listbox in .NET 1.1 on the Compact Framework?

不羁的心 提交于 2019-12-13 08:18:03
问题 From http://weblogs.asp.net/stevewellens/archive/2009/08/19/how-to-fill-a-listbox-dropdownlist-from-an-enum.aspx, I see this example for assigning enum values to a listbox: Array Values = System.Enum.GetValues(EnumType); foreach (int Value in Values) { string Display = Enum.GetName(EnumType, Value); ListItem Item = new ListItem(Display, Value.ToString()); TheListBox.Items.Add(Item); } However, in my Windows CE project (.NET 1.1), there is no "System.Enum.GetValues()"; there is

Filtered list only diplaying 1 line in listbox

做~自己de王妃 提交于 2019-12-13 08:08:12
问题 I have a form that is populating data from a separate spreadsheet which connects to a sharepoint site using a web query. My script filters the data and returns the results into a listbox. Everything seems to work fine, but when I filter two fields it will only return a single result and not the list of data. I have stepped through the code and it is filtering correctly, just not displaying the results. The most confusing thing is I have the exact same code with only one filter on a different

WPF scroll do not working on ListBox inside ItemsControl

微笑、不失礼 提交于 2019-12-13 07:29:16
问题 Need to build image explorer with expanders, but I have some problem with scrolling. I have ItemsControl with ListBox inside, scroll do not work when mouse on ListBox. Here is xaml: <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Grid.Row="1" Background="{DynamicResource LightGrayBackgroundBrush}" > <ItemsControl x:Name="itmsControl" DataContext="{Binding ElementName=_self}" ItemsSource="{Binding ImagesSource}" Margin="15" > <ItemsControl.ItemTemplate

Get Selected Value of SelectedItems in a TextBox (separated with Commas) from MultiSelect ListBox?

本秂侑毒 提交于 2019-12-13 07:27:08
问题 Please tell me how can I get ValueMember of ListBox SelectedItems ? I have read many tutorials but still I am unable to solve it. Any help will be greatly appreciated. int c = subjects_Listbox.Items.Count - 1; for (int i = 0; i >= 0; i--) { if (subjects_Listbox.GetSelected(i)) { txt.Text += subjects_Listbox.SelectedIndices[i].ToString(); txt.Text += ", "; } } 回答1: Your for loop is incorrect. Just try this (this iterate through all SelectedIndices of your ListBox and will add them to your

How to remove text from a list box

跟風遠走 提交于 2019-12-13 07:26:54
问题 I am trying to make an app in Visual Basic that allows an user to type in text and add it to the list as well as remove items from the list. My problem so far is that I can't remove the items, I can add them, just not remove them. My code is as follows: Public Class Form1 Public Listed As String Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim Prompt As String = "Enter Items To Add Here" Listed = InputBox(Prompt) 'Listed is the text

Remove an item from listbox in WP7

非 Y 不嫁゛ 提交于 2019-12-13 07:15:23
问题 I am both a freshman in WP7 and c# development .I confused with listbox removing operate. I want to remove a item through a click event(remove item data and refresh UI).I've searched in website,and knew first resource should extend ObservableCollection, but How to do next?Who can give me a more detail example. Here is my code MainPage.xaml.Example source download <phone:PhoneApplicationPage x:Class="WPListBoxImage.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

How to perform Hold event in Windows Phonw 8?

早过忘川 提交于 2019-12-13 07:00:35
问题 I'm trying to deal with hold event on my Windows Phone 8 project. This is my list's tap event private void lstData_Tap(object sender, System.Windows.Input.GestureEventArgs e) { Bus selectedItemData = (sender as ListBox).SelectedItem as Bus; if (selectedItemData != null) { var num = selectedItemData.Number; var route = selectedItemData.Route; NavigationService.Navigate(new Uri(string.Format("/Details.xaml?parameter1=" + num + "&parameter2=" + route), UriKind.Relative)); } And this is Hold

Excel multi-select, multi-column listboxes

与世无争的帅哥 提交于 2019-12-13 07:00:02
问题 I am having trouble coding a userform that takes the selected data from one multi-column Listbox and adds it to another Listbox on the same userfrom. after adding, the data is removed from the source Listbox "ListBox" is where the data is located, and "listbox1" is where it is being added to. Private Sub add_Click() For i = 0 To ListBox.ListCount - 1 If ListBox.Selected(i) = True Then NextEmpty = ListBox1.ListCount ListBox1.List(NextEmpty, 0) = ListBox.List(i, 0) ListBox1.List(NextEmpty, 1) =

Reloading Listbox content

梦想与她 提交于 2019-12-13 06:59:07
问题 When i see this post Here. However in my code i don't see any DataBind() Method. lstBox.DataBind(); How to reload listbox in C#.Net? Refresh() Method is also didn't work. 回答1: You might try use ObservableCollection as the ItemSource, and all is done automatically. Your task is then to populate items into the ObservableCollection, there is no need to manually update. 回答2: DataBind() is for ASP.NET controls - as far as I'm aware, there is no equivalent method for Windows Forms controls. What's