how to open a .dat file

Signo.X

Well-known member
Joined
Aug 21, 2006
Messages
76
Location
Australia
Programming Experience
1-3
Hello All ,.

i have a console application in vb.net which has a menu, one of the menu option is to open the log file, which stored as .dat format for the application purposes.

i usually use
Process.Start("C:\temp\logfile.pdf")...

it works with most of the data file extenstions.. but it doesnt know how to open a .dat file.

can any one help me please?

Thanks in Advance!
~ Signo.x. :confused:
 
You can start a .dat file in the way that you would a .pdf because a .pdf launches adobe products. This is all to do with file associations. Basically windows needs to know that your .dat file will open with a certain program i.e notepad etc
 
Like Vis said, but to give a bit more detail incase you don't make the association:

VB.NET:
        Dim p As New Process
        With p.StartInfo
            .UseShellExecute = True
            .FileName = "Notepad.exe" 'Application for the system to use
            .Arguments = "C:\Test.txt" 'File for that application to launch with
        End With
        p.Start()
        p.WaitForExit() 'Only if you actually want the program to wait until that file is closed.
        p.Dispose()

Edit:

Oo, post 100 :) Hope I've been of use to some one along the way.
 
If you have a log file that contains text then I'd suggest using the "log' file extension rather than "dat". "dat" is short for "data" and is just a genereal extension used for any data file. A log file is not a generally considered a data file so using the "dat" extension is not really appropriate. Also, the "log" extension is asscoiated with Notepad by default, so you can simply pass the path to Process.Start and it will open.
 
Back
Top