|
|
|
hi all,
i want to write the content of a text file to another txt file exactly like what i have in original file.
i used write,writeline and put functions. but to my surprise, i found the text file is benig written without the new line character.
for example:
original file content:
aefaiojefioae
fafajfpfjafaffjaeiofjafjfjfi
faijfoijf
faioj
Para 2:
fafaopfopfkaokfopfaopkfopkopafopkfpoaf. fijaoijij
fafijoifjfiajparwto
MY COPIED FILE content:
aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoij ffaioj Para 2: afaopfopfkaokfopfaopkfopkopafopkfpoaf. ijaoijij fafijoifjfiajparwto
Can anyone help me on how to write the content of the file exactly as what i have in original?
Thanks,
mahi.
|
|
|
|
|
Why not just use system.io.file.copy?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
File.Copy is the simple way. Copying bytes, not characters (hence using a byte array), is the alternative.
|
|
|
|
|
Is the text in memory, or is it still in the original file?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
text is not in memory ..its in original text file only.
|
|
|
|
|
Then do what everyone else said, and just use File.Copy
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I agree. I think File.Copy would be your best solutions if you want your text file to be exactly the same as the original.
modified on Wednesday, January 27, 2010 10:02 AM
|
|
|
|
|
i have 2 following solution
the first
sqlcommand1.commandText = "insert into customers values('firstName','lastName','phone')
SqlCommand1.ExecuteNonQuery()
the second
'fill into datagridview
SqlCommand1.CommandText = "select * from customers "
SqlDataAdapter1.SelectCommand = SqlCommand1
SqlDataAdapter1.Fill(DataSet1, "customers")
DataGridView1.DataSource = DataSet1
DataGridView1.DataMember = "customers"
'add new row into datatable
row = DataSet1.Tables("customers").NewRow()
row.Item(0) = "firstName"
row.Item(1) = "lastName"
row.Item(2) = "phone"
DataSet1.Tables("customers").Rows.Add(row)
'update data
SqlCommandBuilder1 = New SqlCommandBuilder(SqlDataAdapter1)
SqlCommand1.CommandText = "select * from customers "
SqlDataAdapter1.InsertCommand = SqlCommandBuilder1.GetInsertCommand
SqlDataAdapter1.Update(DataSet1, "customers")
Can you tell me what 's difference between those ?
And which is solution with higher performance
Thank you very much!!
|
|
|
|
|
These two are doing different things, You cant Compare them. I suggest you buy a Book
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I see a lot of this.
Clearly the first is better etc. Why bother filling a dataset in order to perform an insert? The second option will produce the same SQL at the end of the day, but at high cost in processing to generating something you can type yourself in seconds.
|
|
|
|
|
The first one is a little better than the second b/c your using a bit more processing power on your app server to create the dataset you have on the second. In the first, most of the processing will be performed on the database server which is optimized for doing such computations.
modified on Wednesday, January 27, 2010 10:01 AM
|
|
|
|
|
Dear All,
Could any body give me the line code for the given query.
1. If I am clicking mouse button on Row 1 column 3
then it will show in Msgbox "selected Column 3"
2. If I am clicking mouse button on Row 1 column 4
then it will show in Msgbox "selected Column 4"
.........so on.
Thanks
Ashish
|
|
|
|
|
Private Sub MSFlexGrid1_Click()
MsgBox CStr(MSFlexGrid1.Colsel)
End Sub
I are Troll
|
|
|
|
|
Hi,
The below code return 0 ,Even I click on 1,2.3 ...soon column
Private Sub MSFlexGrid1_Click()
MsgBox CStr(MSFlexGrid1.Colsel)
End Sub
Thanks
Ashish
|
|
|
|
|
Ashish Kumar Vyas wrote: The below code return 0 ,Even I click on 1,2.3 ...soon column
Ah, the selection isn't there yet when you click it, so one would have to check what column the mouse is on;
Private Sub MSFlexGrid1_Click()
MsgBox CStr(MSFlexGrid1.mousecol)
End Sub That should fix it
I are Troll
|
|
|
|
|
I Have made a program to set the master volume in XP, but with Vista and Seven this don't work. How to fix this with VB6? THanks!
|
|
|
|
|
You're going to have to do some more research on this, but here[^] is a start.
|
|
|
|
|
Experts i need your help!
I have a database with a search option when a record is selected i want the option for them to sign that record off (checkbox type thing) however at the moment the database seems to be ONLY READ only???
How can i make it so i can initially add bits and pieces to the record or if worse come to worse delete that record?
Many thanks
Dan
|
|
|
|
|
Make the database not "read-only"
|
|
|
|
|
What type of database? SQL Server, MySql, Access, etc...
|
|
|
|
|
i managed to figure it out near enough, thanks any way
|
|
|
|
|
Dan Why VB6
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hello all...
i am trying to develop a project in VB.Net as front end and MySQL or SQL server as back end.
The application is called online music sharing application which is supposed to work on LAN
All i need is that on the request of client or the keyword he types( which can be the name of singer, album or song name) is then searched in the database located at the server and so the list of files matching with the keyword is listed at the client side application.
Later the client can download any of the files among the list and listen to it
..
Here i would also admit that i have worked on VB but never on VB.Net and have no idea of, how the downloading feature and searching will be implemented.
I need to submit this project in say a week or 10 days(fully extended period and i cant take more time...)
i request if there is any help i can get as soon as possible.......
Thankyou...
|
|
|
|