listboxitems

For Each Item in ListBox1 do something then add item to listbox2 vb

混江龙づ霸主 提交于 2020-01-13 05:36:29
问题 I made an app to convert certain numbers to other format i.e 1 = A 2 = B 3 = C 4 = D 5 = E ETC I have made that function with no problem and I have been using it for quite sometime, but now I would like to do things faster and in a batch. So it's really difficult for me to copy from a text file to my Textbox1 then press button1 then copy textbox2 to other text file. So I was thinking in loading the text file into a List Box then do a loop for each item in that list into a second list that I

Casting a ListBox.SelectedObjectCollection to a ListBox.ObjectCollection?

倾然丶 夕夏残阳落幕 提交于 2020-01-11 11:18:32
问题 Is it possible to cast a ListBox.SelectedObjectCollection to a ListBox.ObjectCollection in C#? If so, how would I go about it? 回答1: I have a function that accepts List<string> . I can pass both SelectedItems and Items by casting them. Try this: SelectedItems.Cast<string>().ToList() Items.Cast<string>().ToList() <string> could be replaced with some other object type. 回答2: This is not possible. Instead, you should use an IList . Both of these types implement IList , so you can pass either one

How to get item list from wxpython ListBox

安稳与你 提交于 2020-01-01 14:35:19
问题 Is there a single method that returns the list of items contained in a wxPython listBox? I cant seem to find anything anywhere in the documentation or anywhere for that matter. All that I can think to do is to set the selection to all of the items and then get the selected items, though seems like an ugly roundabout way of doing something that should be simple. Update: As pointed out by jeremy the way to do this is with GetStrings() e.g. listBoxList = yourListBox.GetStrings() 回答1: wx.ListBox

Is there a way to iterate in a ListBox Items templates?

拈花ヽ惹草 提交于 2019-12-24 06:04:08
问题 I have a list box that contains items that are represented by a single textbox. When the user clicks a button, I want to iterate thru all these text boxes and check if their binding expressions are clean of errors; Should be something like: Dim errCount = 0 For Each item In MyListBox.ListBoxItems 'There is no such thing ListBoxItems which is actually what I am looking for. Dim tb As TextBox = item '.........Dig in item to extract the textbox from the visual tree. errCount += tb

Drag and Drop a Folder from Windows Explorer to listBox in C#

若如初见. 提交于 2019-12-21 03:47:14
问题 I succeeded in developing C# code for drag files from windows explorer to listBox. // Drag and Drop Files to Listbox private void listBox1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop, false)) e.Effect = DragDropEffects.All; else e.Effect = DragDropEffects.None; } private void listBox1_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string fileName in files) { listBox1

WPF/C# Binding custom object list data to a ListBox?

放肆的年华 提交于 2019-12-20 11:21:48
问题 I've ran into a bit of a wall with being able to bind data of my custom object list to a ListBox in WPF. This is the custom object: public class FileItem { public string Name { get; set; } public string Path { get; set; } } And this is the list: private List<FileItem> folder = new List<FileItem>(); public List<FileItem> Folder { get { return folder; } } The list gets populated and maintained by a FileSystemWatcher as files get moved around, deleted, renamed, etc. All the list does is keeps

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

Finding Listbox Index of ListBoxItem (ItemsTemplate to specify Visual COntent)

百般思念 提交于 2019-12-12 02:33:04
问题 How do you find the index of a ListBoxItem if it is set within a DataTemplate as a Textbox control? Here is the WPF: <ListBox Name="ScriptEditor" Margin="10" Height="291" ItemsSource="{Binding Path=Script}" SelectionChanged="ScriptEditor_SelectionChanged_1" > <ListBox.ItemTemplate> <DataTemplate> <TextBox Text="{Binding Path=Command}"PreviewMouseDoubleClick="Command_DoubleClick" GotFocus="ScriptEditor_GotFocus" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> When I gain focus of the

Listbox content in another application

血红的双手。 提交于 2019-12-10 16:10:05
问题 How can i read a listbox items in another application's window? I could get the window's handle but i dont know a clear way to access components within. 回答1: You can try to get something from the following project, where is shown, how to enumerate child windows, filter them for a given class name and how to get the items of a list box. I would comment it, but this would be a long story, so please take it as a temporary post ... Unit1.pas unit Unit1; interface uses Windows, Messages, SysUtils,

How to get item list from wxpython ListBox

*爱你&永不变心* 提交于 2019-12-04 14:57:07
Is there a single method that returns the list of items contained in a wxPython listBox? I cant seem to find anything anywhere in the documentation or anywhere for that matter. All that I can think to do is to set the selection to all of the items and then get the selected items, though seems like an ugly roundabout way of doing something that should be simple. Update: As pointed out by jeremy the way to do this is with GetStrings() e.g. listBoxList = yourListBox.GetStrings() wx.ListBox is derived from wx.ControlWithitems . I think GetStrings() is what you need. You can get a list of the