[Message Deleted]
-
[Message Deleted]
-
[Message Deleted]
-
Hi,
Junior Boy wrote:
Please help me to convert this code to C# .net.
We can't able to work for you. This forum is only for sharing the knowledge.
Regards, Jay :)
Hi Jay, Thank you for your replied. And actually I know in this point Yes, sure if I know something that people posted. I would like to reply them too. To me I don't know about VB .net and I just ask for someone who can help me. If they don't want to it's ok but If they do that really appreciate in helping. Regards,
junior boy
-
[Message Deleted]
You should use a converter, then work through the bugs. It's really kind of trivial, and a good exercise, to convery a small snippet like this one. A lot of the commercial converters will convert up to 200 lines in their demo mode, you could also try those. Some of this code kind of sucks, actually. You could amortise it into something simpler, it's not that well written.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You should use a converter, then work through the bugs. It's really kind of trivial, and a good exercise, to convery a small snippet like this one. A lot of the commercial converters will convert up to 200 lines in their demo mode, you could also try those. Some of this code kind of sucks, actually. You could amortise it into something simpler, it's not that well written.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Thank you very much for you suggestion. Finally I got to know and fix all the bugging. This is so appreciate for your comment. Thank you very much,
junior boy
-
[Message Deleted]
VB.NET Code :-
Response.Buffer = True Response.AddHeader("content-disposition", "attachment; filename=MyFile.txt") Const adTypeBinary As Object = 1 Dim BinaryStream As Object BinaryStream = CreateObject("ADODB.Stream") BinaryStream.Type = adTypeBinary BinaryStream.Open() BinaryStream.LoadFromFile("C:\data.txt") Dim BinaryData As Object BinaryData = BinaryStream.Read Response.BinaryWrite(BinaryData) BinaryStream = Nothing Response.End()
Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
-
VB.NET Code :-
Response.Buffer = True Response.AddHeader("content-disposition", "attachment; filename=MyFile.txt") Const adTypeBinary As Object = 1 Dim BinaryStream As Object BinaryStream = CreateObject("ADODB.Stream") BinaryStream.Type = adTypeBinary BinaryStream.Open() BinaryStream.LoadFromFile("C:\data.txt") Dim BinaryData As Object BinaryData = BinaryStream.Read Response.BinaryWrite(BinaryData) BinaryStream = Nothing Response.End()
Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
That looks like VB6 code that is just ported to .NET without converting to .NET technology. There is no reason to use a ADODB.Stream object in .NET, there are better stream objects in the .NET framework. You don't even have to use a stream object in .NET to output a file, there are methods for that in the HttpResponse object. Real VB.NET code:
Response.Buffer = True Response.AddHeader("content-disposition", "attachment; filename=MyFile.txt") Response.WriteFile("C:\data.txt") Response.End()
--- single minded; short sighted; long gone;