vbMarkO Posted August 20, 2005 Posted August 20, 2005 I have code that checks to see if Directory exist... but what I am needing is well something like this; Dim myYear As ? ' Not sure what do here this is Psuedo COde anyway myYear = Year ' What ever Year it is as of the day this code is executed If Directory.Exist("C:\MyMainAppDirectory\" & myYear & "\") ' The Directory 2005(present Year value returned) exist ' Code I want Here Else ' Directory 2005/Present Year-does not exist so Create Year folder End If The Directory its going to search for will be Named by the year BUT NOTE: Its Name will be in this Format 2005 Not 05 So in effect it will search for the Directory called 2005 Any help appreciated vbMarkO P.S. As a bonus question if I might I can write the code to check if a specific file exists in a folder but how would I check if any file exist? Do I just use a WildCard or something? Quote Visual Basic 2008 Express Edition!
Administrators PlausiblyDamp Posted August 20, 2005 Administrators Posted August 20, 2005 Dim myYear as String myYear = DateTime.Now.Year.ToString() Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Joe Mamma Posted August 20, 2005 Posted August 20, 2005 P.S. As a bonus question if I might I can write the code to check if a specific file exists in a folder but how would I check if any file exist? Do I just use a WildCard or something? Look into the System.IO namespace Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
vbMarkO Posted August 20, 2005 Author Posted August 20, 2005 Dim myYear as String myYear = DateTime.Now.Year.ToString() That worked thank you!! I did the same thing with Month But I have a question about Month Right now it returns an Integer how might I get it to return August instead of the integer 8?? I have looked through the help files and I am searching the interenet and have found lots of examples of its use as an integer but nothing else. vbMarkO Quote Visual Basic 2008 Express Edition!
bri189a Posted August 21, 2005 Posted August 21, 2005 P.S. As a bonus question if I might I can write the code to check if a specific file exists in a folder but how would I check if any file exist? Do I just use a WildCard or something? If System.IO.Directory.GetFiles("C:\Folder").Length > 0 Then 'Files exist End If if(System.IO.Directory.GetFiles(@"C:\Folder").Length > 0) { 'Files exist } Quote
Joe Mamma Posted August 21, 2005 Posted August 21, 2005 MessageBox.Show(DateTime.Now.ToString("MMMM")) MessageBox.Show(DateTime.Now.ToString("MMM")) Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
vbMarkO Posted August 22, 2005 Author Posted August 22, 2005 Thanx everyone, this is now resolved thanx to your great examples vbMarkO Quote Visual Basic 2008 Express Edition!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.