|
-
Jul 8th, 2010, 10:55 PM
#1
Thread Starter
Junior Member
Save as .csv files
Hi..
When I save a string into .csv using:
Code:
My.Computer.FileSystem.WriteAllText("c:test.csv", "Hallo,Word", False)
a test.csv is created.
I tried to open test.csv with excell and it is opened just fine.
but when I tried to save it again, it seems like excell didn't recognize it as a valid .csv file. it will show save as type as a unicode text (*.txt) file instead of a *.csv file.
why this is happened?
how to make a real .csv file from vb.net?
thanks for all your help..
-
Jul 8th, 2010, 11:07 PM
#2
Re: Save as .csv files
I just tested with Excel 2010 and it worked fine for me. I can't speak for earlier versions though. How EXACTLY are you trying to save?
-
Jul 9th, 2010, 12:14 AM
#3
Thread Starter
Junior Member
Re: Save as .csv files
Thanks jmcilhinney..
I use a software (ADP6.xx) that can import .csv file.
When I make .csv file from vb.net, ADP6 can not import my .csv until I open .csv and save it again from excel.
I compare .csv before and after save from excel with notpad, both contain exactly the same.
I use excel 2007..
-
Jul 9th, 2010, 12:21 AM
#4
Re: Save as .csv files
There are only two things I can think of, although neither seem likely.
1. That program expects text fields to be enclosed in quotes.
2. That program expects a line break at the end of every record.
-
Jul 9th, 2010, 12:59 AM
#5
Thread Starter
Junior Member
Re: Save as .csv files
So what do you think is missing?
This .csv file is created from vb.net:
{Group Name,Name,Address,Refresh Rate,Comment
,Input0_01,I0.01,Normal,Reset item counter
,Input0_00,I0.00,Normal,Reset item counter
,Flagword0,FW0,Normal,Reset item counter
,Flag1_00,F1.00,Normal,Reset item counter
,Output0_00,O0.00,Normal,Reset item counter
,Output0_01,O0.01,Normal,Reset item counter
,Output0_02,O0.02,Normal,Reset item counter
}
This one is saved from excel:
{Group Name,Name,Address,Refresh Rate,Comment
,Input0_01,I0.01,Normal,Reset item counter
,Input0_00,I0.00,Normal,Reset item counter
,Flagword0,FW0,Normal,Reset item counter
,Flag1_00,F1.00,Normal,Reset item counter
,Output0_00,O0.00,Normal,Reset item counter
,Output0_01,O0.01,Normal,Reset item counter
,Output0_02,O0.02,Normal,Reset item counter
}
{} is not in .csv
thanks..
-
Jul 9th, 2010, 01:13 AM
#6
Thread Starter
Junior Member
Re: Save as .csv files
sorry, nevermind.. i tried again both.. and both work just fine..
still if .csv created from vb.net, that program cannot open..
if i create a .csv file (from notepad), and copy all (ctrl-a) .csv from vb into .csv from notepad.. then, that program can open.
why can this be happened?? what am i missing here??? please help..
-
Jul 9th, 2010, 01:43 AM
#7
Re: Save as .csv files
I suggest that you check the ASCII value of every character in the files. There must be something different between the two that you cannot see.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|