Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
example me project

find folder by the name of version in hardisk
if folder by the name of version found chek file insides folder name version. txt
if folder version insides he is there file version. txt rename version. txt by the name of versionold. txt
if folder version insides he is there file versionolder.txt "call create" (out create file name version. txt)
if folder version and file version. txt and versionold. txt found finish
if folder version and file version. txt and versionold. txt not found finish
end sub


hardisk (c: d: e: etc)

folder name version

file version. txt

file verionold. txt

" call create" out create file name "version.txt"

private create()

print revision
print revision

end sub
Posted

i am not yet experienced can given example detailer

example me program


Private Sub Form_Load()
Dim CheckFile1, CheckFile2 As String

' Check if folder exists, first.
If Dir("c:\version", vbDirectory) = vbNullString Then
Exit Sub
End If

' Check if file exists
CheckFile1 = Dir$("c:\version\version.txt")
CheckFile2 = Dir$("c:\version\versionold.txt")
If CheckFile1 = "version.txt" And CheckFile2 = "versionold.txt" Then
Exit Sub
ElseIf CheckFile1 = "version.txt" Then
Name "c:\version\version.txt" As "c:\version\versionold.txt"
Call CreateFile
End If


End Sub




Private Sub CreateFile()
' =========================================
'
' =========================================

Open "\version\version.txt" For Output As #1

Print #1, "Version =1.0 "
Print #1, "Label = 123"
Print #1, ""


Close #1
End Sub


this program in target c:
example
c:\version\ (forder version location c: )
c:\version \version.txt
c:\version\versionold.txt

1.how find folder version if folder version not hardisk c:
example user install me program location d:\ or e:\
2.if folder version found how create me files if folder not hardisk c:\

thanks
 
Share this answer
 
The System.IO namespace has classes like Path, File and Directory which will do everything you want.
 
Share this answer
 
Private Sub Form_Load()
Dim CheckFile1, CheckFile2 As String

' Check if folder exists, first.
If Dir("c:\version", vbDirectory) = vbNullString Then
Exit Sub
End If

' Check if file exists
CheckFile1 = Dir$("c:\version\version.txt")
CheckFile2 = Dir$("c:\version\versionold.txt")
If CheckFile1 = "version.txt" And CheckFile2 = "versionold.txt" Then
Exit Sub
ElseIf CheckFile1 = "version.txt" Then
Name "c:\version\version.txt" As "c:\version\versionold.txt"
Call CreateFile
End If


End Sub


Are you using VB6, or are you just being taught to use VB.NET as badly as it's possible to use it ? What is Dir ? What is vbNullString ? Use .NET, not VB6 carryover garbage. System.IO contains ALL you need. For example, System.IO.Directory.Exists will tell you if a directory exists.

Replace the c:\ with a variable, and fill that variable by iterating over the available drives using the System.IO namespace.
 
Share this answer
 
hii bro..,

I've installed visual studio express 2008, which it does VB.net?, Because do not know, whether that product microsoft VB.Net also?
I beg of rock and the information, because I am still learning.

Thanks before ...

regard,
Doni
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900