listbox

Trouble synchronizing generic TList and TListBox

风流意气都作罢 提交于 2019-12-23 01:58:48
问题 I have trouble keeping a TListbox in sync with a TList. Each time an item is added to a generic TList, OnNotify is called and the callback calls just one procedure: create_gradients . Its code is below: procedure TColor_Dialog.create_gradients; var Editor: TGradient_Editor; eGradient: Int32; y: single; s: string; begin List_Names.Clear; List_Gradients.Clear; for eGradient := 0 to FColor_Editor.nGradients - 1 do begin List_Names.Items.Add (FColor_Editor [eGradient].Check_Rainbow.Text); end; //

ASP.NET Populating Listbox issue

我与影子孤独终老i 提交于 2019-12-23 01:05:39
问题 As of right now I am trying to create an ASP.NET page which will list books from a category, in a listbox based upon which category button you choose and then I have another two buttons (one for DESC order and one for ASC order). Now the issue is when I click on the ASC or DESC button after hitting the fiction button and populating the list box it wipes the list box. I posted a similar question earlier, got some fixes, but it is still wiping the listbox when I hit the ASC or DESC buttons. I'm

How to access ListBox dynamically-created-items' properties from code-behind?

余生长醉 提交于 2019-12-22 18:37:59
问题 XAML: <Window x:Class="WpfApp_ListBoxTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <ListBox Name="lb" Margin="0,0,0,70"></ListBox> <Button Height="23" HorizontalAlignment="Left" Margin="12,0,0,41" Name="btnAdd" VerticalAlignment="Bottom" Content="Add item" Width="75" Click="btnAdd_Click"></Button> <TextBox Height="23" Margin="93,0,12,41" Name="txtInput"

Select ListBox item on rightclick in Word VBA

岁酱吖の 提交于 2019-12-22 18:15:21
问题 I'm developping a project in Word 2003 with VBA. I have a multiselect ListBox with some entries (dates). On rightclick I'd like to have an InputBox popping up where the user can change the selected date. This works well, as long a specific item is already focused (not only selected, but focused). But, if you rightclick on an item without focus, the box shows up and changes the date of the focused entry, not always the one you rightclicked. I found this answer (http://www.vbarchiv.net/tipps

How to Find the Greatest and lowest value in listbox

佐手、 提交于 2019-12-22 17:55:24
问题 I am new in c#, I am using these to find the greatest and lowest value . int[] numbers = new[] { 1,2,3,4,5 }; int min = numbers.Min(); int max = numbers.Max(); I want to find the greatest and lowest value from list box by something like this int[] numbers = new[] { listbox1.items }; int min = numbers.Min(); int max = numbers.Max(); There would be great appreciation if someone could help me. Thanks In Advance. 回答1: try this: var numbers = listBox1.Items.Cast<object>().Select(obj => Convert

WPF - bind a listbox to a list<string> - what am I doing wrong?

◇◆丶佛笑我妖孽 提交于 2019-12-22 17:50:21
问题 I'm trying to do something very basic here, something I wouldn't have expected to give me this many problems. I have a public property on my main Window class called ItemList which is of type List<string> . I add to this list throughout the life of the program, and would like the ListBox control I have on my form to automatically update when I add new items to the ItemList property. So far, I have the following XAML: <Window x:Class="ElserBackupGUI.Main" xmlns="http://schemas.microsoft.com

Binding WinForms ListBox to object properties

旧城冷巷雨未停 提交于 2019-12-22 17:46:18
问题 I am doing some WinForms coding for the first time and am trying to use data bindings. I have a listbox which I bind to an array of strings from my controller object and I also want to bind the SelectedItem from the list box to another string property on the controller so I can track it. listBox.DataSource = controller.ItemNames; listBox.DataBindings.Add(new Binding("SelectedItem", controller, "CurrentItem")); I want the CurrentItem property on the controller to be updated as soon as the user

Binding to nested property only showing first item in list

↘锁芯ラ 提交于 2019-12-22 12:38:24
问题 I am trying to bind a ListBox Control in C# Winforms in .NET 4.5 to a list of objects that have a nested property that I wish to use for a DisplayMember. It sort of works except that when I set the DisplayMember to the nested property the listbox only shows one item even though there are two items in the list that it is bound to. If I comment out the code for setting the DisplayMember the listBox shows two items. Is this a bug in the framework? I would like to avoid adding another property or

Populate list box with a named range

我们两清 提交于 2019-12-22 11:25:30
问题 I'm working on my first ever VBA project, and need a bit of absolute newbie guidance. I have a submission form that staff will be using to submit their daily KPIs. I have a list box control in a user form called "lstName" that employees will use to select their name before submitting the form Employee names are stored in a named range on "Sheet11" called "EmpName". I want to direct the list box to draw the list of names from the "EmpName" range on Sheet11; but don't know how I would do this

WPF ListBox - how to put values from dataTable?

偶尔善良 提交于 2019-12-22 10:45:29
问题 I have ListBox and want to put values in this listbox from a DataTable : listBoxVisibleFields.DataContext = SelectedFields; Where SelectedFields is a DataTable filled with data. But this code does not work. My ListBox is empty. As I remember, in WinForms was sucha a thing for list box like ValueMember and DisplayMember , but in WPF I dont find something like that... Does someone know how to fill simply my ListBox from DataTable ? 回答1: The property you are looking for is ItemsSource instead of