Hello,
My question is simple. I have a project (T7A) where the operator enters into the textbox name of the exported datalogger1 and when he clicks on the button, Datalogger1 will save CSV file to USB with the specified name, which he wrote in the textbox.
I tried through the script define the name of the logger, but still I can not rename the saved file, it always has the name Dataloger1.
Is there any other way than through the script to define the user name for the exported file?
BR
JohnCZ
Rename Name of Exported Dataloger throught textbox
Rename Name of Exported Dataloger throught textbox
- Attachments
-
- Výstřižek.JPG (60.54 KiB) Viewed 7932 times
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Rename Name of Exported Dataloger throught textbox
The name is defined in the dialog box you posted. You can not change it at run time. If you want to change it, you would have to search the location where you saved the datalogger file and rename it using a script.
For example, if you saved a file called "Datalogger 1", after you export the datalogger you would need to use C# code to search that location for a file called "Datalogger 1" and change its name to what ever you want.
For example, if you saved a file called "Datalogger 1", after you export the datalogger you would need to use C# code to search that location for a file called "Datalogger 1" and change its name to what ever you want.
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Rename Name of Exported Dataloger throught textbox
Thanks
I make some script and Now it works.
JohnCZ
I make some script and Now it works.
JohnCZ
Re: Rename Name of Exported Dataloger throught textbox
Here is that script i Used.
Code: Select all
void Button1_Click(System.Object sender, System.EventArgs e)
{
string FromFile = @"\Hard Disk\DatabaseExport\Data Loggers\DataLogger1.csv";
string Tofile = @"\hard Disk\DatabaseExport\Data Loggers\";
try
{
File.Move(FromFile, Path.Combine(Tofile, TextBox1.Text)); // pokus o přesun
}
catch (IOException ex)
{
Console.WriteLine(ex); // pokud není soubor nebo je špatně napiš Error
}
}
}
- Attachments
-
- Projekt1.zip
- (33.64 KiB) Downloaded 652 times