Thanks
Special thanks Lakshmi Prajwal
successful programs work proof.xml to proof.xml.bak :-D
FULL CODE ME
Imports System.IO
Imports System.Xml
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim filepath As FileInfo
dim data1,data2 as string
filepath = GetFilePath()
=============================================
....????
data1=poof.XML
data2=poofold.XML
If System.IO.File.Exists(poof.XML)then ????
If System.IO.File.Exists(proofold.xml)then ???
exit sub
elseif proofold.xml then
call createfile
=========================================
If Not filepath Is Nothing Then
File.Move(filepath.FullName, filepath.DirectoryName + "/" + "proofold.xml")
call createfile
End If
End Sub
Public Function GetFilePath() As FileInfo
Dim files, directories As Array
Dim fl As String
Dim filepath As FileInfo
Dim finfo As FileInfo
directories = Directory.GetDirectories("c:\Program Files\")
For Each fl In directories
files = Directory.GetFiles(fl, "poof.XML", SearchOption.AllDirectories)
If files.Length > 0 Then
finfo = New FileInfo(files(0))
Return finfo
End If
Next
Return finfo
End Function
Private Sub createfile()
File.Create( ??????? location proof.xml)
writer.WriteStartDocument()
End Sub
End Class
Why error :sigh:
Warning 1 Unused local variable: 'filepath'. C:\Documents and Settings\Admin\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb 18 13 WindowsApplication1
Warning 2 Variable 'finfo' is used before it has been assigned a value. A null reference exception could result at runtime. C:\Documents and Settings\Admin\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb 29 16
WindowsApplication1
works programs
but the error appears 2 Warning:confused:
if found proof.xml rename files proofold.xml (program aready)
createfiles call found a place where proof.xml (in the folder where proof.xml found)
if proof.xml and proofold.xml already found the file where
:)