Click here to Skip to main content
15,351,370 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
turbosupramk318-Jul-16 4:58
Memberturbosupramk318-Jul-16 4:58 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
Richard MacCutchan18-Jul-16 6:15
mveRichard MacCutchan18-Jul-16 6:15 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
turbosupramk318-Jul-16 7:49
Memberturbosupramk318-Jul-16 7:49 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
turbosupramk319-Jul-16 4:10
Memberturbosupramk319-Jul-16 4:10 
QuestionClose Form Popup before opening MessageBox.Show and the form use delegate ? Pin
Member 245846717-Jul-16 22:47
MemberMember 245846717-Jul-16 22:47 
AnswerRe: Close Form Popup before opening MessageBox.Show and the form use delegate ? Pin
OriginalGriff17-Jul-16 22:51
mveOriginalGriff17-Jul-16 22:51 
Questionc# parser questions. Pin
elfenliedtopfan517-Jul-16 13:13
Memberelfenliedtopfan517-Jul-16 13:13 
AnswerRe: c# parser questions. Pin
OriginalGriff17-Jul-16 21:42
mveOriginalGriff17-Jul-16 21:42 
Since you appear to have the code to read from a file, all you need to do is list the relevant files into a list box - which is pretty much trivial to do:
C#
private void LoadFileNames(string folder, string extension, ListBox lb)
    {
    string[] files = Directory.GetFiles(folder, "*" + extension);
    lb.DataSource = files.Select(f => Path.GetFileNameWithoutExtension(f)).ToList();
    }

All you need to do is ensure that your "weapons" files have a unique extension and call the method:
C#
LoadFileNames(@"D:\Temp", ".txt", myListBox);

When the user selects a file, pull the file name from the list box, put the extension back on, and use Path.Combine to add the folder back in.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: c# parser questions. Pin
elfenliedtopfan518-Jul-16 3:31
Memberelfenliedtopfan518-Jul-16 3:31 
GeneralRe: c# parser questions. Pin
OriginalGriff18-Jul-16 4:11
mveOriginalGriff18-Jul-16 4:11 
GeneralRe: c# parser questions. Pin
elfenliedtopfan518-Jul-16 7:24
Memberelfenliedtopfan518-Jul-16 7:24 
GeneralRe: c# parser questions. Pin
OriginalGriff18-Jul-16 8:02
mveOriginalGriff18-Jul-16 8:02 
GeneralRe: c# parser questions. Pin
elfenliedtopfan518-Jul-16 9:28
Memberelfenliedtopfan518-Jul-16 9:28 
GeneralRe: c# parser questions. Pin
OriginalGriff18-Jul-16 9:33
mveOriginalGriff18-Jul-16 9:33 
GeneralRe: c# parser questions. Pin
elfenliedtopfan518-Jul-16 10:31
Memberelfenliedtopfan518-Jul-16 10:31 
QuestionContextMenu on a MenuItem in ContextMenu possible in WPF? Pin
Imagiv16-Jul-16 4:08
MemberImagiv16-Jul-16 4:08 
QuestionRe: ContextMenu on a MenuItem in ContextMenu possible in WPF? Pin
User 1106097916-Jul-16 7:53
MemberUser 1106097916-Jul-16 7:53 
AnswerRe: ContextMenu on a MenuItem in ContextMenu possible in WPF? Pin
Imagiv18-Jul-16 1:19
MemberImagiv18-Jul-16 1:19 
GeneralRe: ContextMenu on a MenuItem in ContextMenu possible in WPF? Pin
User 1106097918-Jul-16 1:28
MemberUser 1106097918-Jul-16 1:28 
GeneralRe: ContextMenu on a MenuItem in ContextMenu possible in WPF? Pin
Imagiv18-Jul-16 2:02
MemberImagiv18-Jul-16 2:02 
GeneralRe: ContextMenu on a MenuItem in ContextMenu possible in WPF? Pin
Pete O'Hanlon18-Jul-16 2:18
mvaPete O'Hanlon18-Jul-16 2:18 
AnswerRe: ContextMenu on a MenuItem in ContextMenu possible in WPF? Pin
Mycroft Holmes16-Jul-16 13:43
professionalMycroft Holmes16-Jul-16 13:43 
Questionno parameterless constructor defined for this object Pin
Gilbert Consellado15-Jul-16 17:36
professionalGilbert Consellado15-Jul-16 17:36 
AnswerRe: no parameterless constructor defined for this object Pin
OriginalGriff15-Jul-16 20:04
mveOriginalGriff15-Jul-16 20:04 
GeneralRe: no parameterless constructor defined for this object Pin
Gilbert Consellado16-Jul-16 0:49
professionalGilbert Consellado16-Jul-16 0:49 

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.