deliever
deliever

Reputation: 11

Save a textfile as current time and date

So I am using VB.NET and I got this problem where I wanna save something (this works) but the one thing I can't get to work is that is automatically saves (title) as current time and date (like this as title: 06/04/2015 10h30min25s) I am using the SaveFileDialog to save my text.

Upvotes: 1

Views: 1687

Answers (2)

Steven Doggart
Steven Doggart

Reputation: 43743

Rather than using the file path as returned by the dialog, you can simply build the path yourself using the current date and time. For instance:

Dim filePath As String = Date.Now.ToString("MM-dd-yyyy HH\hmm\minss\s")

Upvotes: 2

Lance
Lance

Reputation: 3932

Change your slashes to dashes. You can't have slashes in a file name.

Upvotes: 1

Related Questions