Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
Questioncant run my C# program after installation - only if i Run as administrator Pin
goldsoft18-Dec-15 22:59
goldsoft18-Dec-15 22:59 
AnswerRe: cant run my C# program after installation - only if i Run as administrator Pin
Dave Kreskowiak19-Dec-15 4:18
mveDave Kreskowiak19-Dec-15 4:18 
QuestionRe: cant run my C# program after installation - only if i Run as administrator Pin
Richard MacCutchan19-Dec-15 21:15
mveRichard MacCutchan19-Dec-15 21:15 
QuestionStoring path of a selected Listbox File Pin
Member 1218422117-Dec-15 11:50
Member 1218422117-Dec-15 11:50 
AnswerRe: Storing path of a selected Listbox File Pin
Mycroft Holmes17-Dec-15 12:07
professionalMycroft Holmes17-Dec-15 12:07 
GeneralRe: Storing path of a selected Listbox File Pin
Member 1218422117-Dec-15 12:24
Member 1218422117-Dec-15 12:24 
AnswerRe: Storing path of a selected Listbox File Pin
Richard Andrew x6417-Dec-15 14:43
professionalRichard Andrew x6417-Dec-15 14:43 
AnswerRe: Storing path of a selected Listbox File Pin
BillWoodruff17-Dec-15 18:04
professionalBillWoodruff17-Dec-15 18:04 
You can bind the ListBox (set as the 'DataSource of the ListBox) to a Dictionary:
C#
Dictionary<string, string> LbItemsToFilePaths = new Dictionary<string, string>
{
   {"ABC", @"D:\Music\XYZ"},  {"XYZ", @"D:\Music\Old\XYZ"} 
};

private void Form1_Load(object sender, EventArgs e)
{
    listBox1.DataSource = new BindingSource(LbItemsToFilePaths, null);
    listBox1.DisplayMember = "Key";
    listBox1.ValueMember = "Value";
}

// then you can get the filepath from the 'SelectedValue property of the ListBox
// when the user selects an item at run-time:
string selectedFilePath;

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    selectedFilePath = listBox1.SelectedValue.ToString();
    Console.WriteLine(selectedFilePath);
}

«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin

QuestionC# Linq Where vs FirstorDefault Pin
Kevin Marois17-Dec-15 5:42
professionalKevin Marois17-Dec-15 5:42 
AnswerRe: C# Linq Where vs FirstorDefault Pin
Philippe Mori17-Dec-15 6:15
Philippe Mori17-Dec-15 6:15 
AnswerRe: C# Linq Where vs FirstorDefault Pin
Gerry Schmitz17-Dec-15 6:54
mveGerry Schmitz17-Dec-15 6:54 
AnswerRe: C# Linq Where vs FirstorDefault Pin
BillWoodruff17-Dec-15 8:07
professionalBillWoodruff17-Dec-15 8:07 
GeneralRe: C# Linq Where vs FirstorDefault Pin
Kevin Marois17-Dec-15 11:57
professionalKevin Marois17-Dec-15 11:57 
GeneralRe: C# Linq Where vs FirstorDefault Pin
Mycroft Holmes17-Dec-15 12:05
professionalMycroft Holmes17-Dec-15 12:05 
GeneralRe: C# Linq Where vs FirstorDefault Pin
F-ES Sitecore18-Dec-15 0:16
professionalF-ES Sitecore18-Dec-15 0:16 
GeneralRe: C# Linq Where vs FirstorDefault Pin
BillWoodruff18-Dec-15 2:17
professionalBillWoodruff18-Dec-15 2:17 
GeneralRe: C# Linq Where vs FirstorDefault Pin
F-ES Sitecore18-Dec-15 2:24
professionalF-ES Sitecore18-Dec-15 2:24 
GeneralRe: C# Linq Where vs FirstorDefault Pin
BillWoodruff18-Dec-15 6:35
professionalBillWoodruff18-Dec-15 6:35 
QuestionMessage Removed Pin
17-Dec-15 2:12
Member 1221357217-Dec-15 2:12 
Questionhow can i improve these code's display efficient? Pin
smallkubi16-Dec-15 19:43
smallkubi16-Dec-15 19:43 
AnswerRe: how can i improve these code's display efficient? Pin
Dave Kreskowiak17-Dec-15 2:20
mveDave Kreskowiak17-Dec-15 2:20 
GeneralRe: how can i improve these code's display efficient? Pin
smallkubi17-Dec-15 6:09
smallkubi17-Dec-15 6:09 
GeneralRe: how can i improve these code's display efficient? Pin
Dave Kreskowiak17-Dec-15 6:21
mveDave Kreskowiak17-Dec-15 6:21 
GeneralRe: how can i improve these code's display efficient? Pin
smallkubi17-Dec-15 13:50
smallkubi17-Dec-15 13:50 
GeneralRe: how can i improve these code's display efficient? Pin
smallkubi18-Dec-15 6:24
smallkubi18-Dec-15 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.