Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: mjzrpr on July 21, 2021, 04:10:56 AM

Title: string problem ""
Post by: mjzrpr on July 21, 2021, 04:10:56 AM
hello
I want save DRO in the external file but keep first line. when read first line and write to new file. it saved by added "".
For example the first line( that want keep it) is screw01. after running code 5 time the first line is """""screw01""""".
how to remove "". thanks
Code: [Select]
Dim fich As String
Dim FileData As String
fich="offset_"&GetUserDRO(1000)&""
If Dir(fich)="" Then
MsgBox fich&&" not found"
Else
Open fich For Input As #1
Line Input #1, FileData
namedesc=FileData
Close #1
End If
Open fich For Output As #2   ' Open to write file.
Write #2, (namedesc) 'problem
For x = 1000 To 2255
DROState = GetUserDRO(x)
Write #2, DROState
Next x
Close #2
Message "save done!"
Title: Re: string problem ""
Post by: TPS on July 24, 2021, 07:36:19 AM
try to use this:
Code: [Select]

namedesc = Mid(FileData,2,Len(fileData)-2)

Title: Re: string problem ""
Post by: mjzrpr on September 12, 2021, 04:36:49 AM
thank you TPS. it works well by your code. :)