Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create a temp file with VB.NET
Post: #1
Thumbs Down 

Temp files are generally used for temporary storage and data manipulation. This is often necessary for storing user data, user preferences, session information, application cache, and many other types of information.

In order to get the name of the file that you can use as a temp file in VB.NET, I suggest using the GetTempFileName method of the Path class. While there are multiple approaches to creating a temp file, it's really helpful to use the System.IO.Path because it returns a unique file name in the current user's temporary directory; you can use that file name to create a file for storing temporary information. Note that calling this method multiple times will result in getting a different file name each time even if you don't use that name to create a file. This behavior prevents name collisions between multiple applications.

In my sample code, I define the string variable, sTempFileName, and assign the System.IO.Path.GetTempFileName method's return value to it. This produces a temp file name that I can use. I then create a FileStream object, fsTemp, and request that the system create a file with the filename, sTempFileName. Once the file is created, I add data to it (this code is omitted in the example). After that, the temp file is closed.

Code: [Select]
Private Sub TempFile()
Dim sTempFileName AsString = System.IO.Path.GetTempFileName()
Dim fsTemp AsNew System.IO.FileStream(sTempFileName, IO.FileMode.Create)


'write data to the temp file



End Sub

Important Note..!

If you are not satisfied with above reply ,..Please


So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: how to create aweb page in htmlwith coding onincredible india, net worth of, ennadu net 10 3 2013, controlling of blast furnace temp using plc pdf, create mobile os using java, www udouga warthe net, seminar of crioge3nic grindingare in vb net,

Quick Reply
Type your reply to this message here.

Image Verification
Image Verification
(case insensitive)
Please enter the text within the image on the left in to the text box below. This process is used to prevent automated posts.

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  ZFS FILE SYSTEM project topics 1 2,370 08-12-2012 02:07 PM
Last Post: seminar details
  ADO.NET Application Development Technology computer girl 0 415 05-06-2012 12:22 PM
Last Post: computer girl
  Minimizing File Download Time in Stochastic peer-to-peer networks electronics seminars 7 6,260 15-03-2012 12:32 PM
Last Post: seminar paper
  ANT HOC NET seminar projects crazy 2 2,493 13-02-2012 12:30 PM
Last Post: seminar paper
  AS2 protocol for file transfers Electrical Fan 1 1,980 24-01-2012 10:09 AM
Last Post: seminar addict
  File Transfer Protocol seminar surveyer 2 1,818 20-01-2012 10:06 AM
Last Post: seminar addict
  ccsds file delivery protocol full report project reporter 1 973 07-01-2012 03:40 PM
Last Post: project uploader
  Building Blocks of .NET seminar class 0 1,001 25-03-2011 09:52 AM
Last Post: seminar class
  File Handling seminar class 1 1,560 21-03-2011 04:10 PM
Last Post: seminar class
  FILE AND RECORDS MANAGEMENT SYSTEM seminar class 0 869 22-02-2011 02:48 PM
Last Post: seminar class