Click here to Skip to main content
15,894,405 members
Home / Discussions / C#
   

C#

 
QuestionRe: To "this." or not to "this.", that is the question... Pin
Poolee3-Aug-07 10:29
Poolee3-Aug-07 10:29 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Martin#6-Aug-07 19:59
Martin#6-Aug-07 19:59 
AnswerRe: To "this." or not to "this.", that is the question... Pin
Colin Angus Mackay2-Aug-07 11:52
Colin Angus Mackay2-Aug-07 11:52 
AnswerRe: To "this." or not to "this.", that is the question... Pin
V.2-Aug-07 20:27
professionalV.2-Aug-07 20:27 
GeneralRe: To "this." or not to "this.", that is the question... Pin
originSH2-Aug-07 21:56
originSH2-Aug-07 21:56 
GeneralRe: To "this." or not to "this.", that is the question... Pin
V.2-Aug-07 22:28
professionalV.2-Aug-07 22:28 
AnswerRe: To "this." or not to "this.", that is the question... [modified] Pin
Malcolm Smart2-Aug-07 21:06
Malcolm Smart2-Aug-07 21:06 
QuestionGrab path of most recent file in a directory Pin
newb2vb2-Aug-07 8:43
newb2vb2-Aug-07 8:43 
This is a fun one!!!

I have a ActiveX control that automatically creates files at certain intervals and save them to a folder on the hard disk. I have no control over the file name the ActiveX control uses and cannot see a way to capture the file name as it is being stored to disk.

I do however know the path, it is a set path that I do have control over.

So how would the code look to into the folder (let's say c:\data) find the file that was written last (the most recent file in the folder) and put the whole path (c:\data\1234556.txt) into a textbox? It has got to be easy but I am not getting it. I want it so when I click a button, I can see that last log file path that was put into the directory.

I got close when I used the ".LastWriteTime" property, and using a messagebox I was able to get it to show me the date and time of the newest file correctly but I don't know how to get the filename of that particular file.

Here is what I have so far, and I think I am close.

String ImgPath = textBox2.Text;

FileInfo myFile1 = new FileInfo(ImgPath);
String NewFile = myFile1.LastWriteTime.ToString();








MessageBox.Show(NewFile);

Thanks in advance!!!

Mike
AnswerRe: Grab path of most recent file in a directory Pin
led mike2-Aug-07 9:21
led mike2-Aug-07 9:21 
GeneralRe: Grab path of most recent file in a directory Pin
Martin#2-Aug-07 9:34
Martin#2-Aug-07 9:34 
GeneralRe: Grab path of most recent file in a directory Pin
led mike2-Aug-07 9:59
led mike2-Aug-07 9:59 
GeneralRe: Grab path of most recent file in a directory Pin
Martin#2-Aug-07 10:01
Martin#2-Aug-07 10:01 
QuestionCircular Button Pin
emo00622-Aug-07 8:07
emo00622-Aug-07 8:07 
AnswerRe: Circular Button Pin
Tarakeshwar Reddy2-Aug-07 9:14
professionalTarakeshwar Reddy2-Aug-07 9:14 
AnswerRe: Circular Button Pin
ekynox2-Aug-07 14:03
ekynox2-Aug-07 14:03 
Questionsub total a bindingsource with an array Pin
crash8932-Aug-07 7:27
crash8932-Aug-07 7:27 
AnswerRe: sub total a bindingsource with an array Pin
led mike2-Aug-07 7:39
led mike2-Aug-07 7:39 
GeneralRe: sub total a bindingsource with an array Pin
crash8932-Aug-07 8:13
crash8932-Aug-07 8:13 
GeneralRe: sub total a bindingsource with an array Pin
led mike2-Aug-07 9:12
led mike2-Aug-07 9:12 
GeneralRe: sub total a bindingsource with an array Pin
crash8932-Aug-07 10:32
crash8932-Aug-07 10:32 
GeneralRe: sub total a bindingsource with an array Pin
crash8934-Aug-07 6:12
crash8934-Aug-07 6:12 
QuestionCalling a Moss2007 webservice and the 401 error Pin
sameerhanda2-Aug-07 7:10
sameerhanda2-Aug-07 7:10 
QuestionInvoke C# dll from Excel Pin
Bert delaVega2-Aug-07 7:05
Bert delaVega2-Aug-07 7:05 
AnswerRe: Invoke C# dll from Excel Pin
wilcodk2-Aug-07 23:47
wilcodk2-Aug-07 23:47 
GeneralRe: Invoke C# dll from Excel Pin
Bert delaVega3-Aug-07 2:54
Bert delaVega3-Aug-07 2:54 

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.