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

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -