Help How to write vb code

stu

Member
Join Date
Aug 2005
Location
England
Posts
783
Hi guys
I am trying to write a bit of code
If a button is pressed then copy c:\ Data_lineb to d: (USB)
I am using rsview32 visual basic, can anyone help
I am new to vb and review32
 
Something like
Dim DestFile as string
DestFile = "d:Yourfilename"
if ButtonPressed then
'delete if already present
If FileExists(destFile) Then Kill DestFile
FileCopy "c:\ Data_lineb", DestFile
EndIf

That's for VB6, but it should be similar
 
i have found this in the help file in rsview32 vba
but it pops up with an error sub? and highlights dim c: data_line6 can anyone help thanks stu
If OPENFILE_COPY = 1 Then 'BUTTON TAG NAME
Dim C: DATA_LINE6 , D: DATA_LINE6
SourceFile = "C DATA_LINE6" ' .
DestinationFile = "D: DATA_LINE6" ' Define target file name.
FileCopy C: DATA_LINE6 , D: DATA_LINE6 ' Copy source to target.
End Sub
 
Stu's code is fine but will crash if the file D: DATA_LINE6 exists

That's why I have in mine
If FileExists(destFile) Then Kill DestFile
(FileExists is a function that you can find easily on the web)
 

Similar Topics

Good Morning everyone, I need your help to rewrite the code or better way to write the code because honestly I didn't like how the code is right...
Replies
27
Views
7,895
Hi every body. I am new here also very new in PLC coding. I need to write ladder code for the following conditions. 1. When you press the button...
Replies
46
Views
10,082
I am new to PLC programming and just started a new internship where they are asking me to write a pretty simple program. I am studying Mechanical...
Replies
27
Views
19,940
I'm doing my final year project on PLC.If some body sends or helps me on how to get source code for PID,that makeS me happieR.And in addtion to...
Replies
4
Views
2,742
I have a auto-start button with the function with the coding of the following: FUNCTION StartAuto() INT Counter = 0; WHILE Counter <...
Replies
8
Views
6,568
Back
Top Bottom