Writing/Reading .dat Files?

Dec 28, 2009

seeing as '.dat' files contain only what you want them to and there is no preset encryption for them etc could I write data to one by using this simple process:

1) Change file extension to '.txt'
2) Decrypt
3) Write
4) Encrypt
5) Change file extension to '.dat'

and pretty much the same for reading it. or am I thinking to simply?

I thought of the above way as i know how to write to text files already, but is this the best way to do it? or is there a better way?

EDIT: Nevermind you just write to it like a text file and encrypt/decrypt it. request lock/delete from mod.

View 2 Replies


ADVERTISEMENT

Reading And Writing INI Files

Mar 12, 2011

I'm creating a simple forms application where users can enter their details and save the information to a .ini file because I needed this for a simple game profile. I've tried to make it write "Name =" + txtname.Text but it won't work anymore. And as well as that, I don't think It will load the text back from the ini file.

Here's the code I used;
Public Class Form1
Dim hFile As Long
Dim sFilename As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code] .....

Form designer: [URL]
Form1.resk: [URL]
Form1.vb: [URL]

View 18 Replies

Better Ways For Reading And Writing To .txt Files?

Jun 29, 2006

I am trying to create a bunch of records, there will be a limited number of "Codes", about 50. Each "Code" is associated with a name from a textbox, I was trying to have it save each one when you click a button, to a .txt file.So, from the start the record will be blank, the person will go through the form, choose a number from a numerical up and down box, pick a name associated with it (both of these are mandatory and not implied). When they click the button, it will save the contents I talked about into a .txt file, say the number is #2, and the name is "Bob", the next time they try to change that value for #2, it will overwrite "Bob".

View 6 Replies

Getting A Code For Reading And Writing To Files?

Jul 18, 2012

I have been given the task of basically reading and writing to and from files. Below is the code from one sub:

If btnSaveRecipe.Enabled = True Then
FileName = "C:UsersLeylaDocumentsRecipe TaskRecipe.txt"
FileWriter = New IO.StreamWriter(FileName)

[code]....

I can't work out what i've done wrong, but when I open the file itself in the folder, it is empty.

View 1 Replies

Reading And Writing To Ini Files In VB 2010?

Sep 13, 2010

I am trying to search for snippet for reading and writing ini files in visual basic .net.

View 3 Replies

Reading From And Writing To Text Files?

Mar 11, 2010

Input File to read:
SAMPLE NO: 10S-02013
Moisture 10.1

[Code]....

I am not getting the right output I need, as whenever it reads a line, it looses my sample numeber.

View 8 Replies

Reading/writing Files VS2008?

Apr 6, 2009

I'm writing a system with several programs, each of which will start off with a number of 'run time parameters' which will be stored in what I call 'personality files'. Each file will have about 10 elements ( file locations, logo files, dates, numbers , text strings ). I"m starting by building little programs which maintain ( build and modify ) the personality files. To begin the first one, I"m only reading/writing 3-4 strings ( I"ll graduate to dates and numbers later )When I run the program below, I get " The process cannot access the file 'c:yyyyyyyy.zzz' because it is being used by another process. ". I also get"A first chance exception of type 'System.IO.IOException' occurred in Microsoft.VisualBasic.dll "

I get these errors even though I've done the usual stuff like deleting other versions of the test file, cancelling other processes which might be involved, and so on.

Code:
'.... user has clicked on SAVE in menustrip ....
Private Sub FileSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileSave.Click

[code]....

View 19 Replies

Reading/writing Text Files?

Mar 3, 2009

so i have it so that the user input three initials and presses an enter button. Then it goes into a listbox where theusers initials and game score enter. I then have it transfer to a text file. all this works but i need some code toun through the text file and arrange them from highest to lowestheres my current "HighScore" codei know its going to be a for loop but im a beginner in vb and it would be so much easier in java button1 is the enter buttonbutton2 is the save button that saves to a text file

Imports System.IO
Public Class HighScore
Dim objStreamWriter As StreamWriter

[code]......

View 5 Replies

Using DAT Files - Reading - Writing And Formatting

Sep 1, 2011

i was wondering does any know of any good tutorial on using dat files eg reading writing and formatting. I am pretty sure you and use stream reader and writer form the IO but what about formatting.

View 14 Replies

VS 2010 Reading And Writing Files?

Dec 27, 2010

My app has a series of parameters that is to be stored in an external files. Eventhough the "parameter" file could be edited by the end user, I really don't care that much about what the user does to them.

So my two questions are, what is the most effeicent means of reading and writing a file and in what format should the file be in? When I say effeicent I mean, what utilizes the least amount of memory during the process, is fast, and disposable.

Example: XML, Text, something else. StreamReader / StreamWriter or what ever.

View 3 Replies

Reading Writing To External App.config Files?

Aug 28, 2010

I need to read the keys from several external applications .config files, is it possible to specify the file for AppSettingsReader?

View 1 Replies

Reading/Writing Files On Networked Comps?

Nov 12, 2009

how I should go about getting the names of the computers on a network. And if the comp had file sharing on, get the "tree" of dirs on the computer. Would I need to authenticate myself in order to read/write actual files to it?

how to even get started, so I don't have any code - the best thing I can think about doing is getting the tree of "\\network" or something. (forgot what it was called)

find some code (or give some search keywords or names of APIs) that would allow me to see and write/create files on a networked comp.

View 1 Replies

Text Files Reading Writing Resources

Jul 30, 2009

I am witting an app that will generate batch files to do an unattended installation of a share point 2007 farm. I already have a batch file I use and it's pretty big. I copied and pasted the content into my application, and I'm using the System.IO.StreamWriter to write to the batch file from the winform. [code]As you can probably guess, I'm doing all of this in my mainform code window. There are maybe 3 or 4 batch files that will be generated based on the selections made on the form. For example, I'm generating a batch file to create the OU, Group and service accounts the farm will use in active directory, I'm creating a batch file for all of the variables that will be used for the additional batch files created, etc. How can I split this up? is there a way to create the batch files without having to actually copy, paste my existing batch file content into the mainform code window? I'm using file.writeline on each line of the pasted content by the way.

View 7 Replies

UniObjects For .NET - Reading And Writing UniVerse Files

Feb 13, 2010

Our organization is using UniObjects for .NET but the CD seems to have gone missing. I need to figure out how to read and write to and from files in Universe. note the program is written in VB.NET

Dim uniSession As UniSession
Private DATABASE_IDENTIFIER As String = "uvcs"
uniSession = UniObjects.OpenSession(_hostname, _username, _password, _account, DATABASE_IDENTIFIER)

[Code]...

how to insert new values, and read values from the LICENCE_STATUS table.

View 1 Replies

VS 2010 Reading/Writing Text Files?

Oct 12, 2011

I have seen a few different ways of Reading/Writing Text files. What i am trying to achieve is a simple debug file in the most efficient way possible. Currently I have....

If System.IO.File.Exists(debugpath) = True Then
Dim Debugwriter As New System.IO.StreamWriter(debugpath, True)
Debugwriter.WriteLine(debugwrite)
Debugwriter.Close()

[code]....

1. Do I have to close and reopen the file each time I want to write to it.

2. In vbscript I would simply open the the file at the start of the script and close at the end is the same possible here.

View 3 Replies

Writing To And Reading From Files On Phone Using Com Ports?

Aug 31, 2011

I have this htc evo phone of mine and I know there are programs that can read and write to the phone via com ports, well anyway is there a way to read and write to files on my phone via com ports, I know you can but how? Because the only thing I can do in comports in vb is ComPort1.Write() and ComPort1.Read so how do I navagate through the phone via comports and read a files contents. And write to it.

View 3 Replies

Diary Program - Reading, Writing Text Files?

Jan 23, 2012

i have started programming a diary sort of program. i have a home form which takes you to other features. im not sure if there is an easier way to do this but the view is week by week with a new week on a new form. and on each form i have a separate text box for each day. using the code:

'In the form load event:
txtMonday.Text = My.Computer.FileSystem.ReadAllText("DayMonth.txt")
'In the text-changed & form closing event:
My.Computer.FileSystem.WriteAllText("DayMonth.txt",
Monday.Text, False)

View 5 Replies

Increase Speed Of Reading And Writing Text Files?

Sep 1, 2009

I have created a code in VB.NET to read data from text files. Data is read from a list of files, where each file is changed using a for loop. Data is written to a new text files. Each file is read one by one and written in the same way. Now, my speed of execution is very slow. I am using a Quadcore processor with only 20-30% of CPU utilization when my code runs. Is there anyway I can increase the speed of reading and writing? To read only 125 files it takes 10 minutes or more, which is very slow indeed, because in the end I need to read thousands of files and write them. Each file is approxiamately 30-50kb.

Here is my code.

Public Sub ReadRMRDataFileIntoTextFiles()
'Read in the customerids once up front
Dim customerids As Collections.Generic.List(Of String)

[Code].....

View 5 Replies

Writing And Reading Simple Structures From Files Into An Array

Dec 23, 2010

I coded anything but I remember when using VB6 or Pascal/Delphi we used to define records/ structures with fixed length fields, then write those structures to a file knowing that they would always be the same length. You could then open a particular record within the file or simply find out how many records existed by reading the file length.From what I understand, it seems that such methods are depreciated in VB.NET and such structures are written as a stream.Does it now mean that we can define things like variable length strings and not need to worry about buffers or boundaries?Is it possible to read through such files and pick out individual records? Are there methods of determining how many records that exist in a file? What I'm looking to do is simply store multiple records of a structure in a file then retrieve them into an array so I can manipulate their order by sorting the array and search within the array. This is only a learning project so it is unlikely that the resultant array is going to be large, although if this is not generaly a good method of doing this then it might be interesting to fidn out what is. So far, I have read that they way to write a structure to a file is to "serialises" it and then write the bytes - is this correct?[code]

View 5 Replies

[2008] Reading And Writing Files : Open "infile90.txt" For Input As #1

Jul 20, 2009

im not able to find lots of command that i used to use in vb 6 i want to know the syntax for READING THE TEXT FILE and WRITING THE RESULT IN TEXT FILE in vb6 i used the following syntax:: Open "infile90.txt" For Input As #1 this is giving me error...

View 2 Replies

Reading And Writing Files On External Hard Drive, Code To Ensure SQL Or Data Read/write Execution In Case Of Periodic Drive Reconnect?

Dec 18, 2010

The drive is connected via USB and the problem I'm having is that, periodically, while my code is executing, the usb drive seems to disconnect and reconnect. (Nothing to do with the program, but the drive itself).I want to find a way to prevent these temporary drive reconnects from interrupting my code. IE, i want to insure that whatever read or write that is requested is actually executed even in the case of a temporary drive interruption.

View 1 Replies

VS2010 .NET And Windows 7 Access Denied On Writing To Or Creating Files In Project Files Folder?

May 22, 2012

Ok I know this question has been asked to death but I still have not seen a good answer. I have created an application in VS2010 using VB.NET. In my application I have an error log that is an XML file located in the Public gstLocalErrorLogLocation As String = Application.StartupPath & "ErrorLog"that gets written to in the event of an error so I can trouble shoot application easier. My application also downloads files from our FTP site and puts the files in Public gstLocalDownloadLocation As String = Application.StartupPath & "download"So I have files that get read and written to as well and created and deleted all in the Application.StartupPath which is either "c:Program Files(Application Directory)(Some Directory)(Some File)" or "c:Program Files (x86)(Application Directory)(Some Directory)(Some File)" depending on 32bit or 64bit Windows 7.

After creating the setup I install it on my test machine that have both Windows 7 32bit and 64bit.Everything in the application works great till I have to write to, delete or creat a file in those directories above. I know it is an access issue and the UAC. This will get installed on numerous systems so the options I have seen to change file or folder permission on the computers manually is not an option.What has to happen is after I install the application it just works like when you install it on XP. Some post have suggested that you us a user with administrator privilages or group which is all fine and dandy but the user I have used to test the application has all of that.

So what I am asking is how do you create an application with VS2010 in VB.NET that after creating a setup package and installing on Windows 7 will just work with out "Access to the path c:Program Files(Application Directory)(Some Directory)(Some File) is denied." If I have to install this on 100 Windows 7 computers it has to be a concreate no manually doing anything just install and work like when we installed on XP.

View 5 Replies

Reading And Writing To 64 Bit Registry?

Sep 20, 2010

I need to read a value (and possibly adjust the value) in HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall key on both 32 and 64 bit systems.I've tried accessing 'stuff' by compiling my widget as both a 32 and 64 bit app, but nothing is working. Then I came across some information indicating that this could be done from a 32 bit applicaiton using KEY_WOW64_64KEY [URL] somehow, but I can't figure it out.

1) Check the existing value of HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall{ProductGUID}DisplayVersion handling both architectures.

2) If the value <> "" And <> Our Current Version Then

3) Write the Current Version to the value mentioned in step 1.

I wouldn't think this is that difficult as I've worked with registry before, but the 64 bit stuff is throwing me for a loop.It would be nice if I could compile my app to target AnyCPU then detect where its running on 32 or 64 bit. The app could then look and update in the appropriate location.I currently am set to use .NET 2.0, but could go to 4.0 if there is something in there that makes the above tasks easier.

View 1 Replies

Reading And Writing To A Txt File

Jun 27, 2011

I have a tab spaced txt file that looks somthing like this;

[Code]...

I'd like to be able to read in the file and have a pop up message ask somthing like this; "Is cash1 for comp1 correct?" If yes ask about the 2nd line and if not ask what the real cash total is and then over write that to the file, then ask about the 2nd line.

View 2 Replies

Reading And Writing To Csv File?

Dec 31, 2010

i am working on a Yahtzee projeect for college and am struggling with reading and writing to a csv file the code i have to read the file works but only gets the first column and displays it on a line not as a list.

Private Sub HighScoreFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[Code]....

the other criteria i have to work towards and wondering if anyone can help is to limit the amount of records to 10 so need to check what the lowest score is and if the current score is higher over write it,

View 5 Replies

Reading And Writing To Settings.cfg?

Jan 15, 2009

i want my form to read a textfile and make it like line 1 will put in textbox1.text and line 2 will put it in like textbox2.text and like when the app closes it writes textbox1.text to line 1 and textbox2.text to line 2 in the .cfg file

i found acouple codes, but i havent found one that worked for what i wanted to do

View 3 Replies

Reading And Writing To/from A Database?

Jun 16, 2010

I have a table in a database with 3 columns: OfferName, ExperienceAward, and GoldAward

I populate a combobox with the various offer names with the code below:

Dim con As OleDbConnection = New OleDbConnection( _
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:UsersDouglasDocumentsVisual Studio 2008ProjectsGameBoxRPGGameBoxRPGContacts.accdb;Persist Security Info=False")
Dim cmd As OleDbCommand = New _

[Code]....

View 2 Replies

Reading/Writing To Config.app?

Apr 13, 2011

The code below has a green line below the text after Return. VB10 states that the context is obsolete but I cannot find a new method to get rid of it

Imports System.Configuration
Public Class Form1
Public Shared Function ReadSetting(key As String) As String

[code]......

View 10 Replies

Resources Reading And Writing?

Jul 23, 2009

how to write and read from and to resource file, pressuming they are text files. I tried using the standard file streams but that does not work.

View 6 Replies

VS 2008 Writing To A .ini Then Reading It?

Mar 22, 2010

Ive searched for the pass hour on how to do this. Everything ive found is for vb6 and it wont work with 08 for some reason. Here is what i am doing, and the way i want to do it.I have a login form that has a checkbox remember me. Inside the if statement (If chkRemember.Checked = true) I want the code to write the username and password in a config.ini file in this format;

[LoginInfo]
Callsign=dsfsdf
Password=dsfdsf
[GeneralInfo]

Can someone provide me with a code i can use for this? I also want to be able to read that data to.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved