• A little help in C#?
    7 replies, posted
I'm working on a few projects and was wondering if anybody had any good insights on some features i need to add to them. They are windows forms applications and I'm working in Visual Studio 2015 of course. One project needs a list to be populated from an open file dialog. The list needs to show the file name, possibly a name that you've given it or that can be gained from the file and the directory it belongs to. The other project needs to be able to generate tones and combine them in a random assortment. All help is appreciated from the forums, and thanks for any help.
I'm not exactly sure what you want here. When you say open file dialog, do you mean that box that opens when you click file>open on a typical windows application? Where is the list appearing? Is it opening a windows explorer window? If so, why do you need to program your own list feature? When you say tones, what do you mean? Musical tones? Color tones? How are they being displayed? Maybe draw up some mspaint sketches or take screenshots of preexisting apps to demonstrate what you mean.
For the open file dialog i mean that when someone clicks file>add then a file browser should open, which it already does. Then when you select a file it should then add the file to a list. For the tones i do mean musical, they don't really need to be displayed but i do need a log to be created that shows what notes are being generated.
[QUOTE=neonwhite;50352279]For the open file dialog i mean that when someone clicks file>add then a file browser should open, which it already does. Then when you select a file it should then add the file to a list. For the tones i do mean musical, they don't really need to be displayed but i do need a log to be created that shows what notes are being generated.[/QUOTE] So is the list a text file, or is it represented in the application somehow? Does the list just display filenames, or does it enable some sort of interactivity? For the tones, you could probably use the inbuilt windows forms stuff to create a scrolling list of buttons that plays the tone when you click them, iirc it supports playing of sounds directly through the form.
It is a ListBox represented in the application window. I just need it to display the file names and some details of the file. For the tones though it needs to generate multiple tones over a span of time and not just when an event is triggered.
[QUOTE=neonwhite;50352967]It is a ListBox represented in the application window. I just need it to display the file names and some details of the file. For the tones though it needs to generate multiple tones over a span of time and not just when an event is triggered.[/QUOTE] I don't know if you've solved this by now, but filenames are easy. Getting the file name you can use [URL="http://msdn.microsoft.com/en-us/library/system.io.path.getfilename.aspx"]Path.GetFileName()[/URL] What details of the file do you need displayed?
[QUOTE=FlakTheMighty;50560851]I don't know if you've solved this by now, but filenames are easy. Getting the file name you can use [URL="http://msdn.microsoft.com/en-us/library/system.io.path.getfilename.aspx"]Path.GetFileName()[/URL] What details of the file do you need displayed?[/QUOTE] Alternatively you can create a FileInfo instance from the filepath, and read the Name property of that. FileInfo also exposes plenty of other useful attributes too.
Sorry, you need to Log In to post a reply to this thread.