listbox

Clicking on a listbox means I can't click on anything else on the form.

I'm using a databound listbox in a C# WinForm application. When I click on an item in the listbox nothing else on the form works, even when I click on the close button the form doesn't close. Everything works fine until I select an item. What I have tried to do is in the listbox1_SelectedIndexChanged set the listbox1 focus to false b...

Programmatically multiselection update is slow in listbox.

I try to programmatically update the selected items in a listbox, with extended selection mode. Here is how I do it: foreach (var selectedItem in ItemsForSelection) { _myList.SelectedItems.Add(selectedItem); } My problem is, that when the number of the selected items is big, the update is very slow. The root of the problem is tha...

Data Bound listbox selectedindex always -1

I've got a simple upload form. Here's my code: <form id="Form1" method="post" enctype="multipart/form-data" runat="server" <asp:label id="lblMsg" runat="server" CssClass="msg" /> <span class="msg">Select Gallery:</span> <asp:listbox id="gallerySelect" runat="server" Rows="1" DataTextField="galleryName" DataValueField="galler...

Why is ListBoxFor not selecting items, but ListBox is?

I have the following code in my view: <%= Html.ListBoxFor(c => c.Project.Categories, new MultiSelectList(Model.Categories, "Id", "Name", new List<int> { 1, 2 }))%> <%= Html.ListBox("MultiSelectList", new MultiSelectList(Model.Categories, "Id", "Name", new List<int> { 1, 2 }))%> The only difference is that the first h...

ListBox not updating in non debug

Does anyone have any idea why my ListBox would not populate when running in non Visual Studio Debug version? When running in debug version(F5) it perfectly fine without any breakpoints, but when I run in non debug(Ctrl+F5) it doesn't get populated. I don't even know where to start regarding this as google shows nothing useful and I can...

Sorting a Listbox by value

I have a list box that I need to sort by the values not the text. I'm very new to this so please excuse my ignorance. I started looking at IComparer but I'm some what lost in how to use it. How can I overload my list box with this new sort? Thank You ...

Making a ListBox item editable

I've got a plain-old WPF ListBox defined in my .xaml: ... <ListBox Name="foo"> </ListBox> ... In my matching .xaml.cs I programmatically add strings to this ListBox. I'd like to be able to edit these strings from the UI at runtime. I'm new to WPF, so my first thought was to dynamically replace the string in the ListBox's colle...

Binding results of a sql query to listbox

I am getting stuck on this problem. It seems simple but for some reason im having trouble. Here is what I have of the following: Try cn = New OleDbConnection("Provider=microsoft.Jet.OLEDB.4.0;Data Source=G:\Sean\BMSBonder3_0.mdb;") cn.Open() str = "Select Distinct BonderIdentifier From [Session]" cmd ...

Loading listboxes inside tabitems - which event to use?

Lets say I have an application which comprises one window. Inside the window is a tabcontrol, with three tabitems. Inside each tabitem is a usercontrol. In one tab I have Add color. In the next tab I have add Fruit. In the third tab I have relationships, where the user can add links between the fruit and the colors. This relationship is...

WPF- Resizing Listbox Contents according to Listbox dimensions

Hello, I am attempting to resize the contents of my listbox according to the listbox itself. This is being done in WPF. Any ideas on how this might be possible? I have been searching and have not come up with anything obtainable... Any helpful ideas are appreciated, Thanks! ...

Remove focus rectangle from ListBox item

How do you remove the focus rectangle from a silverlight ListBox? I have this code: <ListBox x:Name="MyListBox" > <ListBox.ItemTemplate> <DataTemplate> <Grid > ...snipped... </Grid> </DataTemplate> </ListBox.ItemTemplate> <ListBox.ItemContainerStyle> <Style Targe...

WPF Listbox.selecteditems returns items in the order they were selected

Hi, I was debugging a co-workers program and ran across this issue in WPF. It looks like the listBoxName.SelectedItems returns a list of selected items, in the order a user selects the item from the interface. This is a problem because I need to preserve the actual order the items. Example: the listbox is in Extended selectmode and ...

Check if value from ListBox exist in DataGridView

I have a ListBox and the user adds selected values from it to a DataGridView. I don't want duplicates so is there a way to check if the value from the ListBox already exist in the DataGridView? ...

Add ListBox items from Dataset

hi there, I have this C# code. j = myAccountDataset.Tables["AccountsTables"].Rows.Count; for (i = 0; i <= (j - 1); i++ ) { listAccountList.Items.Add(myAccountDataset.Tables[0].Rows[i][1]); } this.listAccountList.SelectedIndex = 0; the idea is to ite...

WPF ListBox Scroll to end automatically

Greetings, in my application i have a listbox with items. THe application is written in WPF. How to scroll automatically to the last added item? I want the scrollviewer to be moved to the end of the list when new item has been added. Is thare any event like "ItemsChanged"? (I don't want to use SelectionChanged event) ...

How do I maintain viewstate on a user control

I have an ASP Page that uses two listboxes and a third party control (Fluent.ListTransfer) to transfer values from one list to the other. Fairly standard stuff: <td> <asp:ListBox ID="ListBoxAvailable" Runat="server" SelectionMode="Multiple" EnableViewState="true"> </asp:ListBox> </td> <td style="vertical-align: middle"...

MS Access 2003 - Automatically show last records in list box on a form rather than first

So I have a form that has a listbox that shows like a ledger. My question is how can I make it display the last records (or have the scroll bar default to the bottom instead of the top), instead of the first few as the default. Now I don't mean reversing the order from bottom to top instead of top to bottom (though that would be a cool ...

How do I filter a ListBox based on input from a TextBox?

i am new in programing i need help regarding how to filter listbox via using textbox in c# application. I mean enter some text into textbox and filter same time in listbox if items exits in lists then select into textbox else open new form for creating the items kindly give me example for the same. ...

autocompleted textbox related to listbox in c# application

hi snipperx thx for ur autocompleted texbox coding related to listbox control. see I am new here you have suggested autocomplted textbox code for listbox control.I am confused how to generate the same whether in form1.cs or form1.designer.cs or else where if i am trying to generate this code on form1.cs then some of class member not s...

jQuery to change listbox selection mode

Hi I have an ASP.NET page with a listbox whose selection mode is set to multiple by default. I would like to set its selection mode to single on a button click. Code snippet of my attempt: $('#testBtn').click(function(){ $('#testListBox').attr("SelectionMode","Single"); }); It is not working though. What am I doing wro...