none
File.Move RRS feed

  • 问题

  • Does not work for me, I put the System.Import.IO at the top and this is my sample code...And it says "Expression Does Not Produce Value" and File is underlined

    Private

    Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

    File.Move(

    "C:\Users\Chris\Desktop\Trigger Interval\A1.wav", "C:\Users\Chris\Desktop\Trigger Interval\Interval\A1.wav")

     

     

    End Sub
     
    2011年4月22日 4:36

答案

  • Does not work for me, I put the System.Import.IO at the top and this is my sample code...And it says "Expression Does Not Produce Value" and File is underlined

    Try importing System.IO instead of System.Import.IO.

    • 已标记为答案 Paul Zhou 2011年4月29日 5:06
    2011年4月22日 21:22

全部回复

  • Chris,

    Ideally it should not happen in .Net. Try updating the File.Move as below

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        
           Call System.IO.File.Move("C:\Users\Chris\Desktop\Trigger Interval\A1.wav", "C:\Users\Chris\Desktop\Trigger Interval\Interval\A1.wav")
    
    End Sub
    

    OR

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        
           System.IO.File.Move "C:\Users\Chris\Desktop\Trigger Interval\A1.wav", "C:\Users\Chris\Desktop\Trigger Interval\Interval\A1.wav"
    
    End Sub
    

     Hope this helps.


    Please mark this post as answer if it solved your problem. Happy Programming!

    • 已建议为答案 Dimitri C 2011年4月22日 10:57
    2011年4月22日 10:31
  • If above code does not work, then you can use

    System.IO.File.Copy to copy file then delete existing file using

    System.IO.File.Delete

    2011年4月22日 11:08
  • Funny I tried that about ten minutes after I posted this and it worked, which it should work without doing that
    • 已建议为答案 Rex Honour 2011年4月25日 8:07
    • 取消建议作为答案 Rex Honour 2011年4月28日 13:43
    2011年4月22日 18:46
  • Does not work for me, I put the System.Import.IO at the top and this is my sample code...And it says "Expression Does Not Produce Value" and File is underlined

    Try importing System.IO instead of System.Import.IO.

    • 已标记为答案 Paul Zhou 2011年4月29日 5:06
    2011年4月22日 21:22
  • That did fix it, and I don't understand why it need it, when the Imports statement was at the top
    2011年4月24日 20:38
  • Does not work for me, I put the System.Import.IO at the top and this is my sample code...And it says "Expression Does Not Produce Value" and File is underlined

    Private

    Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

    File.Move(

    "C:\Users\Chris\Desktop\Trigger Interval\A1.wav", "C:\Users\Chris\Desktop\Trigger Interval\Interval\A1.wav")

     

     

     

    End Sub
     


    Use import System.IO

    Try using it....

    It should solve 99% of your problem listed above...

    Thanks

    Roozan Bharucha

    MCT, MCPD Windows Frmwk 4.0

    • 已建议为答案 Rex Honour 2011年4月25日 8:07
    2011年4月25日 8:06
  • The VB legacy stuff has it's own File thingy.  Perhaps it was getting confused about what you meant when you typed "File."
    This signature unintentionally left blank.
    2011年4月25日 19:00