DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Filename in SaveDialog

Highlighted

Hi,

I'm working with DIAdem 2017

I would create a SaveDialog and name my file with variabel "sPath". I created saveDialog, but I do not know, how to name my file. Can anyone help me?

many thanks

 

FileDlgFilt = "ASCII Import (*.xlsx),*.xlsx"
If (FileNameGet ("ANY", "FileWrite",DataReadPath, FileDlgFilt, , , "Data selection")="IDOk") then
Dim sFullName,n,m,sPath,fso
sFullName= EditBox1.Text
n = InStrRev(sFullName, "\")
m= InStrRev(sFullName, ".")
sPath =mid(sFullName,n+1,m-n)
GetName = GetFileName(sPath)

0 Kudos
Message 1 of 6
(213 Views)

This looks like code from a dialog box?  You could post a more complete code snippet from your function as well as a screenshot of your dialog box to give more information about the issue

0 Kudos
Message 2 of 6
(185 Views)

my program consists of 2 Button and 2 EditBox. I click on Button1 opendioalog will open and I choose a file then. the name of the file is shown in Editbox1. then I click on Button2 and savedialog will open and I have to enter a name. here I want, the name of EditBox1 is transferred to filename field in SaveDialog.

 

Sub Button2_EventClick (ByRef This)                                                   'EditBox1(Input Opendialog)...............
FileDlgFilt = "ASCII Import (*.mf4;*.dat),*.mf4;*.dat"
if ( FileNameGet("ANY", "FileRead", DataReadPath, FileDlgFilt, , , "Data selection")="IDOk") then
EditBox1.Text= FileDlgFileName
Else
Call MsgBoxDisp ("Keine Datei ausgewählt.")
End if

End Sub


Sub Button3_EventClick(ByRef This)                              'EditBox2(Output saveDialog) .......................
Dim sFullName,n,m,sPath

FileDlgFilt = "ASCII Import (*.xlsx),*.xlsx"
If( FileNameGet ("ANY", "FileWrite",DataReadPath,fileDlgFilt,,,"Datei Speichern")= "IDOk") Then
sFullName= EditBox1.Text
n = InStrRev(sFullName, "\")
m = InStrRev(sFullName, ".")
sPath =mid(sFullName,n+1,(m-1)-n)
EditBox2.Text=  Spath
Else                                                                                    ' Kein Speicherort ausgewählt
Call MsgBoxDisp ("Kein Speicherort ausgewählt.")
End if

End Sub

0 Kudos
Message 3 of 6
(181 Views)

Foto von Dialog

0 Kudos
Message 4 of 6
(180 Views)

Would it be easier to use PathNameGet() to get the path for editbox1 and once you have the path and click the second button, you just get the filename fro the user with InputBox()?

0 Kudos
Message 5 of 6
(168 Views)

thank you for Replay. I could find the Code

0 Kudos
Message 6 of 6
(163 Views)