Hi MVPS and other members in C# Corners
I am very happy to find this site.
I am building a desktop application in c#
and my boss wants a print macro
There a .pdf files in a folder C drive and
in m y application I have items in a listviews
these items are in this form BAR5678SG.pdf and all
I want to be able tolook through each line
in listview and goto that folder and any file that matches
BAR5678SG.pdf send to defaul printer for printing.
Giving there are different items say BAR5645DF.pdf, RE3421.pdf
Please what is the best approach to tackle this, my biggest challenege is
figuring an algorithm that would loop through each distinc item and goto
the said folder and check if a fileexist a the item send to printer.
please any advise is welcome.
Thanks for your advise in adavnce .
Loading

Anil KumarPosted Feb 22, 2015, 9:20 AM
1) You have listbox with all the file names
2) You have files (PDF extension) in a particular folder in c drive
3) on click of some event say "button" click you want to check the matching name in the folder and send the files to the printer
If above is want to achieve, Here comes the solution :-
step 1 : - Loop through all the items in the list box
step 2 :- get the matching file name from the folder. You can try something like this.
string[] dirs = Directory.GetFiles(@"c:\", "* + listbox.item.value + "*.PDF");
Ekona PikinPosted Feb 25, 2015, 9:27 AM
Anil KumarPosted Feb 25, 2015, 3:26 AM
Anil KumarPosted Feb 25, 2015, 3:26 AM
Ekona PikinPosted Feb 24, 2015, 4:03 PM
Anil KumarPosted Feb 24, 2015, 6:44 AM
Ekona PikinPosted Feb 24, 2015, 6:29 AM
Anil KumarPosted Feb 23, 2015, 11:37 PM
Ekona PikinPosted Feb 23, 2015, 9:01 AM
Anil KumarPosted Feb 23, 2015, 12:12 AM
Ekona PikinPosted Feb 22, 2015, 2:08 PM
appreciate your help.
But how do use button_clicks