listbox

Line separation / Line break in a listbox

梦想的初衷 提交于 2019-12-25 02:44:21
问题 I want to display 2 sets of data on the one list box, for example, I would wont to display the 7 times table and the 8 times table on the same listbox. Here is how I get the first set of data displaying: int awnser = 0; int z; z = int.Parse(textBox1.Text); for (int i = 0; i < 11; i++) { awnser = z * i; listBox6.Items.Add(z + " * " + i + " = " + awnser.ToString()); } But how do I get a line break or separation so I can put the 8 times table just underneath? 回答1: How about this? EDIT Insert it

Need multiple styles dependent on Listboxitem

走远了吗. 提交于 2019-12-25 02:43:31
问题 i have a Listbox, which stores two different object types, based on the same baseclass. (e.g. BaseObject = baseclass and the children of it: CustomPath and CustomImage) The Datasource: ObservableCollection<BattlegroundBaseObject> _baseObjectCollection; public ObservableCollection<BattlegroundBaseObject> BaseObjectCollection { get { return _baseObjectCollection?? (_baseObjectCollection= new ObservableCollection<BaseObject>()); } } The Listbox databinding: <ListBox ItemsSource="{Binding

Open file from a listbox

a 夏天 提交于 2019-12-25 02:42:38
问题 I'm trying to open files from a listbox , the files could be Word , PDF , Excel , etc. Does there need to be separate code for each file type, or is there some way to just open the file when its double clicked? The listbox populates fine through the use of the update button I have. Public Class frmMain Private Sub ButtonUpdate_Click(sender As Object, e As EventArgs) Handles ButtonUpdate.Click Dim folderInfo As New IO.DirectoryInfo("my directory is here") Dim arrFilesInFolder() As IO.FileInfo

Stringlist sort progress bar

谁都会走 提交于 2019-12-25 02:03:28
问题 I have a TListBox that can have a very long stringlist when loaded so I have the operator initiate a Sort by clicking a button. Sometimes the sort can take close to a minute and the operator is left wondering what's happening. Is there any way I can use a TProgressBar to show that something is happening? If so, how? OR Can I Grey (visually disabled) the screen at the start and then color back to white when the sort is completed? If so, how? Thanks 回答1: I believe that your fundamental problem

What is the most efficient way to filter listboxes based on selections of another in c#?

浪尽此生 提交于 2019-12-25 02:02:00
问题 I have several listboxes that get each of their data from a separate stored procedure. If the user selects an option in 1 listbox, it should filter the other listboxes. I have done this before by adding logic to the stored procedure, but sometimes it seems to get very long. Does anyone know of a better way to approach this? The way I have it setup now is that for each ListBox, I have an ObjectDataSource which calls a method that calls a stored proc in the database to populate the listbox. 回答1

Custom ListBox with transparent backcolor issue

旧时模样 提交于 2019-12-25 01:55:18
问题 I created a custom multiline ListBox control inherited from ListBox. In the form, the ListBox position is above a WPF rounded and transparent panel hosted in an ElementHost. Now, what I want, is that ListBox backcolor to be transparent. Obviously, this is not allowed in Winforms, a ListBox cant be transparent. Then, I have tried some things, but there is always an issue. What I want to achieve is this: As you can see, this works perfectly, but actually I´m having two problems. The first I get

How to add new item into listbox that using datasource?

偶尔善良 提交于 2019-12-25 01:48:15
问题 I create a winform application that contains 3 textbox ( pcno , pcname and pcipadd ), one listbox that is using a datasource and one button to add new item. I'm having a trouble to add an item to my listbox. I'm using this code on the add item button: _pcno.Add(new PCNo() { PCNO = pcno.Text, PCNAME = pcname.Text, IPADDRESS = pcipadd.Text }); The code above adds the new item successfully, but the selected item in the listbox also been updated. In details, I currently have a "PCN01" on my

VBA multiselect listbox, populate column with selected items

Deadly 提交于 2019-12-25 01:47:07
问题 I have a multiselect listbox populated with unique city names from another sheet. It only has one column of data in the list. It is populated with the code below which was developed with some assistance from some lovely folks on stack exchange. From this listbox I would like to take the items selected by the user to populate column a in the same sheet. I'm pretty sure this is only a couple of lines of code but I am not sure how to go about it, I have not had any success in counting the items

Windows phone listbox - Hold item event

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 01:46:26
问题 My app has a two ListBoxes. I need, when the user hold a item from my ListBox1 , the same item should appear in ListBox2 . My current code works, but I need select item (touch item) before hold item. I know that reason is i'm using SelectedItem , but how do for hold event? My code: private void holdListAdd(object sender, System.Windows.Input.GestureEventArgs e) { if (List1.SelectedItem != null) { Fields fi = (Fields)this.List1.SelectedItem; // fi.Quantity = txtQuantity.Text; if (List2.Items

Loop doesn't update listboxes until it is done iterating

丶灬走出姿态 提交于 2019-12-25 01:26:46
问题 I have a loop that takes file name from a listbox, performs a system() call, then moves that filename to another listbox. Problem is, it doesn't move the filenames over one at a time, but waits until the entire loop is finished and moves them all at once. What would I do to get it to perform how I want it to? the loop: for each( String^% file in filename ) { int x = convert( file ); lbComplete->Items->Add( lbFiles->Items[0] ); // place the completed file lbFiles->Items->Remove( lbFiles->Items