all groups > visual studio .net general > january 2007 >
You're in the

visual studio .net general

group:

What to do NET Framework V2.0 Obsolete API List



What to do NET Framework V2.0 Obsolete API List thejamie
1/31/2007 6:52:01 AM
visual studio .net general: I have a VS2005 dot net error message =>

"This constructor has been deprecated. Please use Filestream(Safehandle
handle, FileAccess access) instead and optionally make a new safefile heandle
with ownsHandle=File if needed."

This is in reference to an VB6 upgrade for the following code:

FileOpen(1, mstrZebraPrinterPath, OpenMode.Output) PrintLine(1,
mstrLabelInfo)
FileClose(1)

Error provides the following link:
http:/go.microsoft.com/fwlink/?linkid=14202

Help, if you know anything about deprecated code or know of a way to print
to a zebra label printer.
--
Regards,
Re: What to do NET Framework V2.0 Obsolete API List Gerry Hickman
2/6/2007 11:59:26 PM
Hi,

It's just telling you to use a more up-to-date form of the FileOpen
call. If it's just a case of sending simple character mode output to a
device that presents itself as a writable file (such as LPT1) you could
probably do this with script and sequential file I/O and save a lot of
trouble.

[quoted text, click to view]


--
Re: What to do NET Framework V2.0 Obsolete API List thejamie
2/7/2007 9:08:01 AM
Found it... looks like this:

Private Shared Sub PrintZebraLabel(ByVal ZebraPrinter As String, ByVal
strWriteLabel As String)
'create an instance of the zebra printer

Try
Dim retval As Integer
Dim outfile As FileStream = New
FileStream(CreatePort(ZebraPrinter), FileAccess.ReadWrite)
Dim fileWriter As New StreamWriter(outfile) '(instance)
fileWriter.WriteLine(strWriteLabel)
fileWriter.Flush()
fileWriter.Close()
retval = CloseHandle(mhPort)
Catch ex As Exception

End Try

End Sub

--
Regards,
Jamie


[quoted text, click to view]
AddThis Social Bookmark Button