|
1.
My.Computer.FileSystem.WriteAllText, without an explicit Encoding, creates a UTF-8, not a Unicode, file; the documentation says:
"When no encoding is specified, UTF-8 is used. The byte order mark (BOM) for the encoding is written to the file unless you specify Encoding.Default, which uses the system's current ANSI code page..."
If you don't want a BOM, use Encoding.Default; or use File.WriteAllText which works without BOM by default.
2.
why do you use a StringBuilder here? I don't think it will be faster than similar string operations in this app, as all you do are global operations, not a long sequence of appends.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Luc,
Thanks for your comments.
I used StringBuilder at the time on the fly when this was a simplier applet; it still works well for the intended use. But I agreed that one day I should clean it up and use more global codes instead of a series of appends.
Can you give me a sample of where in the code and how I should use the encoding.ASCII?
|
|
|
|
|
IvanIT wrote: Can you give me ...
I could, but I'm not going to.
I explained two ways to solve your problem, now use the documentation to figure out the details. Don't be lazy, and learn.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thanks anyway Luc. no laziness here; just a little green and under pressure to get it done ASAP. I will do my homework. Regards.
|
|
|
|
|
That's OK then.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Just to close the loop on this. I got my solution with the codes below. Luc, I did my homework over the weekend. Thanks for the pointer.
<br />
'ASCII encoding<br />
Dim bteCode() As Byte<br />
bteCode = Encoding.ASCII.GetBytes(Me.lblClaimsFile.Text)<br />
<br />
My.Computer.FileSystem.WriteAllText(FileName, newString.ToString, False, Encoding.ASCII)<br />
<br />
MessageBox.Show("End of Translation ... Adios!")<br />
IT.
|
|
|
|
|
Hello Everybody,
I need to open Outlook "Create New Folder" dialog box programmatic ally on button click. i am using vb.net 2005 and want to open dialog box in outlook 2007.
I m able to open tasks dialog box using following code.
Dim myFolder As Outlook.MAPIFolder
myFolder = outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks)
myFolder.Display()
but not able to open "Create New Folder" dialog box.
Thanks
Regards
Dharmchand Dhingra
|
|
|
|
|
Hi to all
I have find out this problem.
using outlook namespaceclass object you can use pickfolder method. using this it will open dialog box and allow you to create new folder and also choose already created folder.
for example:
dim outlookNameSpace as outlook.namespace
myFolder = outlookNameSpace.PickFolder
Regards
Dharmchand Dhingra
|
|
|
|
|
pls i am in the middle of a project(web based). where i need to deploy the project with web server as on e as the prerequisite. i used windows installer in vs 2008 but i could not get it. any one with assistant could pls send how to to folarinoladimeji@yahoo.com. thanks
|
|
|
|
|
I am sure a simple google search will return a lot of help.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
hello every One
I am using Password in my access database (.mdb) file i want to pass this password in my connection string
I used the string like
Public cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=True;Data Source='" & Application.StartupPath & "\pumpproject.mdb;password=pass")
but its not working please suggest some help its an deskstop applcation...
Thank You
|
|
|
|
|
ConnectionStrings[^]is a good place to begin with.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
check your quotes.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi, I'm looking to create a database within my program. I was planning on using a record type, following something my teacher has said about it being similar to an array. However, having looked for this record type, I figure it must have been for an older version of visal basic.
Is there a way that I can create a database, similar to an array? I'd like to keep it within visual basic if possible, rather than using access, as seems to be quite common.
|
|
|
|
|
outhwaik wrote: atabase, similar to an arra
An array is not a database.
The only thing you can do that somewhat is similar to a database is use a datatable / dataset
But anything you store in there is just in memory and will be lost on exiting the program.
outhwaik wrote: using access, as seems to be quite common
Not really, sql-express is common.
What are you trying to do here?
|
|
|
|
|
I'm planning on saving the data in a text file, to be loaded on starting the program, so the data wouldn't be lost.
I want to avoid using access if possible, as the machine this program will eventually be used on doesn't have access.
What I'm acutally trying to do is, or at least i thought, quite simple. It'll effectively be a small database of the members of a Brownie pack, with names, address, phone number etc stored in different fields.
modified on Friday, October 9, 2009 5:52 PM
|
|
|
|
|
You don't need to have access installed to use it in a .NET program.
So for something this simple I'd suggest using access instead of a text file.
|
|
|
|
|
The entries for the database are going to be entered via visual basic by my user, and the access file won't exist til she creates entries. Is this going to be possible?
|
|
|
|
|
Well you could create the access file when you need to but I don't see the point in it.
Just have a empty access database with the needed tables installed along with the program. Then enter the data as needed.
It will make searching the data easier.
You can always go for the XML option Dave told you about.
|
|
|
|
|
So long as you're not going to be doing any SQL queries against this "database", you can just create a collection of "Member" objects and serialize that collection to an XML file to save it. Upon the next start of your app, deserialize the XML file back into the collection.
|
|
|
|
|
Can you explain a bit more about using an 'XML file'? Again, its not something I've used before.
I'll want to be able to search for records by a couple of different fields, and display parts of the records in different text boxes. Would I be able to do that?
|
|
|
|
|
Here ya go,
HOW TO: Serialize and Deserialize XML in Visual Basic .NET http://support.microsoft.com/kb/316730[^]
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
outhwaik wrote: I was planning on using a record type, following something my teacher has said
Suspect what your teacher referred to was a RecordSet which is ADO technology. With the introduction of ADO.NET RecordSets have been superceded with DataTables and DataSets .
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Do datatables or datasets work in a similar way to arrays? Are they purely contained within visual basic? (with any text files for saving or equivilent)
|
|
|
|
|
outhwaik wrote: Is there a way that I can create a database
Do you want to create a database-file (in any format, say Access), or do you want to create your own database-driver (your own Access, so to speak)?
outhwaik wrote: Is there a way that I can create a database, similar to an array?
Yup, just open Microsoft Access and create a table with a single column. That's a one-dimensional array.
outhwaik wrote: I'd like to keep it within visual basic if possible, rather than using access, as seems to be quite common.
That's quite common indeed, because Access is good at storing data, and it's usually faster/cheaper than rolling-your-own.
I are Troll
|
|
|
|