View Full Version : [Q][Help] Need code for editing and saving file in VB.NET
Fraction
27th November 2008, 09:57 PM
Hay,
i'm trying to develop a program, in VB.NET. i call it wDiary stands for Workout Diary.
The purpose is to let the user choose 4 (or more) sports to save progess/daynotes of, and to view the txtfiles, like a dayly diary in a calendar.
i have comed to that part where i'm want to save a file in a spesific directory.
like save:
"Jogging - " + date".txt in %MyDocuments%\wDiary\Jogging\
print textbox1.text in line one and so on :confused:
like the this code
FileOpen(1, My.Application.Info.DirectoryPath & "\Jogging - "+date".txt", OpenMode.Output)
PrintLine(1, TextBox2.Text)
PrintLine(2, TextBox3.Text)
FileClose(1)
But thats a code i used for an Windows app. I want the same function for my Touch pro (WinCE 6.1) :/
Fraction
Fraction
27th November 2008, 11:40 PM
Reserved..
FrederickUK
28th November 2008, 12:47 AM
Just a quick one, and I understand English might not be your first language but a Dairy is where they bottle milk, and make other dairy produce like cheese and cream.
I think your app should have been called wDiary - as in a diary of events :)
I'm not taking the mick here, just offering a bit of help :) As for the file editing, what language are you doing it in? C++.net, C#.net, VB.net?
If it's vb.net you're using - this site (http://www.astahost.com/info.php/text-file-operations-vb-net_t6372.html) has some decent basic file routines (checking if it exists, adding text, appending, closing etc)
Hope this helps :)
EVILRipper
28th November 2008, 02:08 AM
Doing a quick search, it points out to be VB.net indeed. Try stating which language you use next time. :)
The link in the above post should give you sufficient info.
Fraction
28th November 2008, 09:51 AM
Just a quick one, and I understand English might not be your first language but a Dairy is where they bottle milk, and make other dairy produce like cheese and cream.
I think your app should have been called wDiary - as in a diary of events :)
I'm not taking the mick here, just offering a bit of help :) As for the file editing, what language are you doing it in? C++.net, C#.net, VB.net?
If it's vb.net you're using - this site (http://www.astahost.com/info.php/text-file-operations-vb-net_t6372.html) has some decent basic file routines (checking if it exists, adding text, appending, closing etc)
Hope this helps :)
shit, now i'm embarrassed. no, english is not my primar language. hehe.
Visual basic.net
;)
Fraction
28th November 2008, 09:55 AM
Doing a quick search, it points out to be VB.net indeed. Try stating which language you use next time. :)
The link in the above post should give you sufficient info.
i have edit the topic, and the first post. thanx, i forgot.
Fraction
cornelha
28th November 2008, 11:30 AM
You should be able to use the standard System.IO.StreamReader and System.IO.StreamWriter Functions. I can code this in c# if you can translate to VB.net.
cornelha
28th November 2008, 12:39 PM
Actually let me make another suggestion. Sometimes when writing a small app to collect data I use a very lazy yet very usefull feature of .net DataSets.
I databind the controls to the dataset by dropping the dataset on the form and assiging the bindings via autogenerated bindinsource component. All I do now to read and save are the following lines of code
Read:
dataSet1.ReadXml("mydb.xml");
Write
dataSet1.WriteXml("mydb.xl", XmlWriteMode.WriteSchema);
It might not be pretty but it does the trick. Also less code and no need for parsing XML
Fraction
28th November 2008, 12:54 PM
You should be able to use the standard System.IO.StreamReader and System.IO.StreamWriter Functions. I can code this in c# if you can translate to VB.net.
Yes, please :D
I have one more thing, if sombody can help. the Design seems perfectly in Visual basic. put when i deploy it to the emulator it looks smal and rubbish. the buttons (png.files) gets streched in width and pressed in the height. so, how can i design in 480x640 (VGA) for my Touch pro :/
FrederickUK
28th November 2008, 08:30 PM
I've set my emulator settings to USA WM 6.1 Classic and it works fine when deployed to my touch pro. If your screen resolution is fairly high (I use 1280x1024) you could use USA WM 6.1 VGA but it filled my entire screen. You might have better luck if you use 1600x1280 or whatever (or run multi-monitor)
Hope this helps :)
Fraction
28th November 2008, 09:46 PM
I've set my emulator settings to USA WM 6.1 Classic and it works fine when deployed to my touch pro. If your screen resolution is fairly high (I use 1280x1024) you could use USA WM 6.1 VGA but it filled my entire screen. You might have better luck if you use 1600x1280 or whatever (or run multi-monitor)
Hope this helps :)
i Also use 1280x1024, and i (usa?)VM 6.1 profesional.
and yes it it fills my hole screen ;P
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.