valuemember

Get ValueMember of Selected item in ListBox

。_饼干妹妹 提交于 2019-12-20 06:25:39
问题 I've seen a couple of posts asking a similar question but I have not been able to duplicate the answers in my code successfully. The following code adds items and their value member to a list box. Public Shared Sub ListFiles(hTab As Hashtable) Debug.Print("create file and key" & Now) Dim Enumerator As IDictionaryEnumerator Enumerator = hTab.GetEnumerator() Dim MyKeys As ICollection Dim Key As Object MyKeys = hTab.Keys() If (hTab.Count > 0) Then For Each Key In MyKeys Dim sfileName As String =

How can I add a DisplayMember and ValueMember to a single ComboBox Item that has an assigned DataSource?

限于喜欢 提交于 2019-12-12 02:55:37
问题 I am successfully adding Display/Value pairs to a combobox like this: List<Student> BRStudents = studentsList.Where(h => h.EnrolledInAYttFM) .Where(i => i.RecommendedNextTalkTypeID.Equals(BIBLE_READING_TALK_TYPE)) .OrderBy(j => j.WeekOfLastAssignment) .ToList(); comboBoxBR.DataSource = BRStudents; comboBoxBR.DisplayMember = "FullName"; comboBoxBR.ValueMember = "StudentID"; ...but I then (in some instances) want to add another item to comboBoxBR, one which is not present in the BRStudents list

C#: How to bind to ListBox DisplayMember and ValueMember result from class method?

风流意气都作罢 提交于 2019-12-11 20:14:23
问题 I'm trying to create ListBox where I will have key-value pair. Those data I got from class which provides them from getters. Class: public class myClass { private int key; private string value; public myClass() { } public int GetKey() { return this.key; } public int GetValue() { return this.value; } } Program: private List<myClass> myList; public void Something() { myList = new myList<myClass>(); // code for fill myList this.myListBox.DataSource = myList; this.myListBox.DisplayMember = ??; //

Add 2 or more field to value member of C# coding

空扰寡人 提交于 2019-12-08 09:21:38
问题 I have table with 4 primary key fields. I load that in to drop down list in my WinForm application created by using C#. On the TextChanged event of drop down list I have certain TextBox and I want to fill the information recived by the table for the certain field I selected by the drop down list. So as I say the table having 4 fields. Can I get those all 4 fields into value member from the data set, or could you please tell me whether is that not possible? Thank you. Datatable dt=dba.getName(

Getting ValueMember from selected item in a ListBox with C#

依然范特西╮ 提交于 2019-12-07 03:30:30
问题 I'm trying to get all the selected items ValueMember from a ListBox with C#. For ex.: I've a list like this: ID | Name and Lastname ---------------------- 1 | John Something 2 | Peter Something2 3 | Mary Smith This structure is part of my ListBox. I've builded this listbox with this code: private void fill_people_listBox() { this.listBoxPeople.DataSource = db.query("SELECT ...."); this.listBoxPeople.DisplayMember = "people_name_last"; this.listBoxPeople.ValueMember = "people_id"; } The

Getting ValueMember from selected item in a ListBox with C#

寵の児 提交于 2019-12-05 08:20:57
I'm trying to get all the selected items ValueMember from a ListBox with C#. For ex.: I've a list like this: ID | Name and Lastname ---------------------- 1 | John Something 2 | Peter Something2 3 | Mary Smith This structure is part of my ListBox. I've builded this listbox with this code: private void fill_people_listBox() { this.listBoxPeople.DataSource = db.query("SELECT ...."); this.listBoxPeople.DisplayMember = "people_name_last"; this.listBoxPeople.ValueMember = "people_id"; } The ListBox is successfully populated. When the user wants to save the changes I've to loop throught this list to

Get ValueMember of Selected item in ListBox

拥有回忆 提交于 2019-12-02 13:01:48
I've seen a couple of posts asking a similar question but I have not been able to duplicate the answers in my code successfully. The following code adds items and their value member to a list box. Public Shared Sub ListFiles(hTab As Hashtable) Debug.Print("create file and key" & Now) Dim Enumerator As IDictionaryEnumerator Enumerator = hTab.GetEnumerator() Dim MyKeys As ICollection Dim Key As Object MyKeys = hTab.Keys() If (hTab.Count > 0) Then For Each Key In MyKeys Dim sfileName As String = hTab(Key) Dim first As Integer = sfileName.IndexOf("_") Dim last As Integer = sfileName.LastIndexOfAny