[VB.NET] File Exists
2013-06-16, 07:26 PM, (This post was last modified: 2013-06-16, 07:27 PM by GraveYard.)
#1
I need a code to check if code.txt exist in the same folder with the generator.

I found a lot of codes on the internet, but at all i need to put a path, and i don't know the path, maybe the folder is on desktop (C->USER->Administrator->Desktop) or in D (D:/HackNike)


And i need a code to check if code.txt is in HackNike folder. Without to specific the path, like

Dim curFile As String = "D:\HackNike \code.txt"
Console.WriteLine(If(File.Exists(curFile), "File exists.", "File does not exist."))
2013-06-16, 08:10 PM, (This post was last modified: 2013-06-16, 08:11 PM by street1920.)
#2
If the code.txt is in the same dir of the executable
dim curfile as string = application.startuppath & "/code.txt"
if(file.exists(curfile),y,n)
2013-06-16, 08:48 PM,
#3
hmm, i have some errors
Error 1 'file' is not declared. It may be inaccessible due to its protection level. D:\Hacks\xx\xx\Form1.vb 38 15
2013-06-16, 08:54 PM, (This post was last modified: 2013-06-16, 08:57 PM by street1920.)
#4
you have to import system.io, so before the class declaraion just write "Imports System.IO"

Example:

PHP Code:
Imports System.IO

Public Class Form1

yourcode here

 End 
Class 
2013-06-16, 09:42 PM,
#5
THX man, now working
Dim curfile As String = Application.StartupPath & "/code.txt"
If (File.Exists(curfile)) Then
MsgBox("File exist")
Else
MsgBox("file does not exist")
End If



TC
2013-06-16, 09:50 PM,
#6
=) I'm here to help :D


Possibly Related Threads...
Thread Author Replies Views Last Post
  Aeonsofts VB.NET Theme Manager v2.1 lanzye 32 10,339 2017-10-28, 04:51 PM
Last Post: waiphyoe
  help in file css vip2 1 878 2016-11-25, 12:36 AM
Last Post: torothemes
  .Net Expert Required insomniac 6 1,613 2016-09-08, 08:38 PM
Last Post: styx
  [C++] Finding, reading and using CSV file in C++. Lukasz 4 1,162 2016-09-08, 10:35 AM
Last Post: styx
  [HELP] How to Change Cpagrip Url / File locker Favicon ? ashu55 2 1,314 2016-08-24, 06:35 PM
Last Post: ashu55





About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top