listbox

Can't make the items in a ListBox align correctly using TabStops

余生颓废 提交于 2021-01-29 05:11:21
问题 I have the following problem with ListbBox. To make it easy to understand I have simplified it a bit. public partial class Form1 : Form { private void Form1_Load(object sender, EventArgs e) { listBox1.Items.Add("xxxxxx" +"\t\t\t"+ "yyyyyyy"); listBox1.Items.Add("xxxxxxx" + "\t\t\t" + "yyyyyyy"); listBox1.Items.Add("xxxxxxxx" + "\t\t\t" + "yyyyyyy"); listBox1.Items.Add("xxxxxxxxx" + "\t\t\t" + "yyyyyyy"); listBox1.Items.Add("xxxxxxxxxx" + "\t\t\t" + "yyyyyyy"); } } From row 1 to 4 it prints

Programmatically selecting an Item in a ListBox

有些话、适合烂在心里 提交于 2021-01-28 21:55:53
问题 I have three ListBoxes ( CompanyName , Representative & QuoteNumber ) and I load data from my WCF client, into the CompanyName list box using the method below: private async Task LoadCompanies() { using (TruckServiceClient client = new TruckServiceClient()) { var companies = await client.GetCompaniesAsync(); foreach (var company in companies) lbxCompanyName.Items.Add(new ListBoxViewItem<Company>(company)); } } Now in the coding below I allow myself to select the Company Name in the

Listbox sort/filter by date time in vba userform?

久未见 提交于 2021-01-28 19:14:10
问题 I have a userform with a listbox that displays data from a worksheet. I am wanting to get that data to display in the listbox by current date and time. So when a user enters new data he/she sees the most current lines of data. This is to help the user so they don't enter duplicate information. I am hoping this can be accomplished programmatically because in the near future this form will be linked to a database not a worksheet. Here is the code to populate my listbox: Private Sub UserForm

Pulling content from a selected item in a ListBox (urwid)

情到浓时终转凉″ 提交于 2021-01-28 12:20:24
问题 I'm making a ListBox in urwid where each item is a URL pulled from a list of URLs. When an item is selected and ENTER is clicked, I'd like to pull the URL and open it in the browser. Here's my code so far: class SelectableText(urwid.Text): def selectable(self): return True def keypress(self, size, key): return key def handle_input(input): if input == "": # Open link focus_widget, idx = content_container.get_focus() # TODO: Open link from focus_widget elif input in ('q', 'Q'): # Quit raise

Changing the Name of an Excel ActiveX ListBox

独自空忆成欢 提交于 2021-01-28 12:10:39
问题 I have a set of ActiveX controls and subs that fit together like this: User types into an ActiveX TextBox, TextBox_Click triggers execution of 3 subs. The first sub updates the value of a named range on a sheet; based on that updated value a table is created in excel using an offset function The second sub copies the table range updated in 3 and paste.values into a range on the sheet (to eliminate formulas) Here's where it is breaking down. When I set the sheet up I create one ListBox

How to clear all data in a listBox?

旧时模样 提交于 2021-01-20 17:48:48
问题 I am after a statement that will clear all strings / data that is currently in a listBox, I have tried: private void cleanlistbox(object sender, EventArgs e) { listBox1.ResetText(); } 回答1: What about listbox1.Items.Clear(); 回答2: If it is bound to a Datasource it will throw an error using ListBox1.Items.Clear(); In that case you will have to clear the Datasource instead. e.g., if it is filled with a Datatable: _dt.Clear(); //<-----Here's the Listbox emptied. _dt = _dbHelper.dtFillDataTable(_dt

WPF Input KeyBinding for a ListBox Item

霸气de小男生 提交于 2021-01-20 07:25:12
问题 I'm having a WPF Application, programatically I'm setting the focus to the ListBox Item, after that using UP / Down arrow I'm navigating from one Item to another Item. I need to Implement ENTER Key Event for that appropriate Item, it should trigger the ICommand SelectItemCommand in the ViewModel. Consider the ViewModel Code: public class MobileViewModel { public ObservableCollection<Mobile> MobileCollection { get; set; } public MobileViewModel() { MobileCollection = new ObservableCollection

WPF Input KeyBinding for a ListBox Item

送分小仙女□ 提交于 2021-01-20 07:23:23
问题 I'm having a WPF Application, programatically I'm setting the focus to the ListBox Item, after that using UP / Down arrow I'm navigating from one Item to another Item. I need to Implement ENTER Key Event for that appropriate Item, it should trigger the ICommand SelectItemCommand in the ViewModel. Consider the ViewModel Code: public class MobileViewModel { public ObservableCollection<Mobile> MobileCollection { get; set; } public MobileViewModel() { MobileCollection = new ObservableCollection

How to add multiline Text to a ListBox item?

狂风中的少年 提交于 2021-01-15 07:53:05
问题 I have a little problem and can't find a solution. I would like to put a text at the end of a ListBox item and I have no idea how... TagLib.File f = TagLib.File.Create(paths[i]); listBox1.Items.Add("0" + i + ". " + f.Tag.Title +"\n" + string.Join(", ", f.Tag.Performers) + " - " + "\r" + f.Tag.Album + " " + f.Properties.Duration.TotalMinutes.ToString()); I've already tried it but unfortunately it doesn't work that way. Maybe someone knows how you can always put the text at the end, with a code

How to add multiline Text to a ListBox item?

梦想与她 提交于 2021-01-15 07:50:29
问题 I have a little problem and can't find a solution. I would like to put a text at the end of a ListBox item and I have no idea how... TagLib.File f = TagLib.File.Create(paths[i]); listBox1.Items.Add("0" + i + ". " + f.Tag.Title +"\n" + string.Join(", ", f.Tag.Performers) + " - " + "\r" + f.Tag.Album + " " + f.Properties.Duration.TotalMinutes.ToString()); I've already tried it but unfortunately it doesn't work that way. Maybe someone knows how you can always put the text at the end, with a code