listbox

keep last few characters in listbox VB.NET

时光毁灭记忆、已成空白 提交于 2020-01-04 10:38:43
问题 I am trying to load a .txt file into a richtextbox (Point_BOX), then delete all but the last 5 characters into a listbox (Point_LIST). I've searched online and so far the only way I can get it to work is by removing the first 75 characters from the line (the lines in the .txt file should be 80 characters but sometimes is more/less). Point_BOX.Clear() Point_LIST.Items.Clear() OpenPointDialog.ShowDialog() FileName = OpenPointDialog.FileName Dim sr As IO.StreamReader = IO.File.OpenText(FileName)

Styling ListBoxItem's of nested ListBoxes [WPF]

半城伤御伤魂 提交于 2020-01-04 09:08:41
问题 I have a ListBox with ListBoxItem s that contains a nested ListBox . Now I want the top-level ListBox 's items to not have a blue background then they are selected (see pic). Example Image http://img43.imageshack.us/img43/237/window1.png I tried to use the XAML below with a style to change the background color to transparent as descibed in this blog post. This works, but it also changes the selected background color of the items in the nested ListBox . How do I change it to only apply to the

Delete an item in a listbox with a button, in wpf MVVM

无人久伴 提交于 2020-01-04 09:05:43
问题 I have a problem. It seems a simple thing but it isn't that easy. I have two listboxes, with objects in it. One is full with available objects and the other is empty, and I can fill this up with drag and drop. If you fill this empty listbox, the items are also added to a list of, this is a property of another object. But now my question is how I can easily delete an object in this listbox by clicking on a button. I tried something but it wouldn't run. Here is my xaml: <ListBox ItemsSource="

Selection in ListBox on an Excel worksheet goes blank everytime I do something, why?

喜欢而已 提交于 2020-01-04 07:55:54
问题 So, I have an ActiveX ListBox control named ListBox1 on Sheet1 of my Excel Workbook. I enabled multiple selections on it. I also put some code in the Sheet1 Object: Private Sub ListBox1_Change() Debug.Print "hello world" End Sub Now, if I select three values in my listbox, I see "Hello world" three times in my immediate window. So I guess the Change event triggers correctly. When I select any cell on the same sheet where my listbox is, and I do something with it (e.g. I type "ABCDE" in it, or

Check if an item is already exist in listbox1

好久不见. 提交于 2020-01-04 07:53:24
问题 In form1 I have two listboxs: listbox1, listbox2; loadbutton and savebutton This code will write listbox1.selecteditem into a txt file and loadbutton will load the info. But in listbox2 I want loadbutton to check if that item already exist in listbox2, if not write selected item from listbox1 and if that item already exist in listbox2 then do not save it (msg"this item is already exist in listbox2") This is not working Dim wri As New IO.StreamWriter("e:\test.txt", True) If ListBox2.ToString

Set style to GWT ListBox items

匆匆过客 提交于 2020-01-04 05:52:05
问题 Is there a way to apply css style to GWT ListBox drop-down menu (ex: change color of some items) I can't do it by setting a style to whole ListBox because i wanna different style for each item! Result will be like that: <select class="style1" id="test"> <option class="style2" value=""> </option> <option class="style2" value="AL">Alabama</option> <option class="style6" value="AK">Alaska</option> <option class="style6" value="AZ" class="red">Arizona</option> <option class="style6" value="AR"

WPF - Why do ContextMenu items work for ListBox but not ItemsControl?

不打扰是莪最后的温柔 提交于 2020-01-04 02:57:13
问题 Items in a list have context menus. The context menu items are bound to routed commands. The context menu items work correctly if the list control is a ListBox , but as soon as I downgrade it to an ItemsControl it no longer works. Specifically the menu items are always greyed out. The CanExecute callback in my CommandBinding is not being called either. What is it about ListBox that allows context menu items with commands to bind correctly? Here are some excerpts from a sample app I put

WPF ListBox WrapPanel clips long groups

社会主义新天地 提交于 2020-01-04 02:38:39
问题 I've created a ListBox to display items in groups, where the groups are wrapped right to left when they can no longer fit within the height of the ListBox's panel. So, the groups would appear similar to this in the listbox, where each group's height is arbitrary (group 1, for instance, is twice as tall as group 2): [ 1 ][ 3 ][ 5 ] [ ][ 4 ][ 6 ] [ 2 ][ ] The following XAML works correctly in that it performs the wrapping, and allows the horizontal scroll bar to appear when the items run off

Clarification on binding Listbox.SelectedItem in MVVM

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-04 02:26:07
问题 I have a ListBox in one of my user controls in which I would like to get the SelectedItem , to be used in the ViewModel. The ListBox is composed of TextBlocks . This question is pretty much a straight up answer to my question, but I don't understand where DisneyCharacter (his collection type) comes from, or how it relates to the ListBox . Would mine be of type TextBlock ? XAML for ListBox as requested: <ListBox Margin="14,7,13,43" Name="commandListBox" Height="470" MinHeight="470" MaxHeight=

filter a query based on multiple list boxes in a form

旧巷老猫 提交于 2020-01-04 01:58:06
问题 I have an Access database with two tables: "contacts" and "country" These contain a number of fields in each. I have a query, "Filter", that brings these two tables together. I want to create a form with as many list boxes as there are fields in the query. A user can open the form and select multiple data from each list box - the row sources are tied back to the two tables above. Then on the click of a button the query would be displayed and filters would be applied dependent on the users