vb.net - Check if file exist before counting the length of the string in text file -
i having hard time figuring why code of mine gives me unhandled exception error in fact if statement..
if (not system.io.file.exists("c:\file.txt") , system.io.file.readalltext("c:\file.txt").length <> "20") messagebox.show("code executed!") else messagebox.show("failed execute!") end if
can please tell me have missed?
it better break down code shown below makes detecting , debugging whole lot easier. better write few lines happen here not happen @ all.
dim filename string = "c:\file.txt" dim filetext string = "" if io.file.exists(filename) filetext = io.file.readalltext(filename) if filetext.length <> 20 messagebox.show("code executed!") else ' recover end if else messagebox.show("failed execute!") end if
Comments
Post a Comment