Click here to Skip to main content
15,898,134 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Need system clock advice. Pin
nlarson1119-Apr-11 13:28
nlarson1119-Apr-11 13:28 
AnswerRe: Need system clock advice. Pin
Luc Pattyn19-Apr-11 13:11
sitebuilderLuc Pattyn19-Apr-11 13:11 
GeneralRe: Need system clock advice. Pin
nlarson1119-Apr-11 13:30
nlarson1119-Apr-11 13:30 
AnswerRe: Need system clock advice. Pin
Luc Pattyn19-Apr-11 13:38
sitebuilderLuc Pattyn19-Apr-11 13:38 
GeneralRe: Need system clock advice. Pin
nlarson1119-Apr-11 13:52
nlarson1119-Apr-11 13:52 
AnswerRe: Need system clock advice. Pin
Luc Pattyn19-Apr-11 14:32
sitebuilderLuc Pattyn19-Apr-11 14:32 
AnswerRe: Need system clock advice. Pin
Bernhard Hiller25-Apr-11 22:05
Bernhard Hiller25-Apr-11 22:05 
QuestionVisual Basic 2010 printing on a Zebra via serial port Pin
EdMee19-Apr-11 8:11
EdMee19-Apr-11 8:11 
I have a VB 6 app that I have rewritten in VB .Net from VS 2010 framework 4. The examples that I've seen from Zebra show the following

Dim SA As SECURITY_ATTRIBUTES
Dim outFile As FileStream, hPortP As IntPtr

LPTPORT = "LPT1"
Texxxt = Me.RichTextBox1.Text
hPort = CreateFile(LPTPORT, GENERIC_WRITE, FILE_SHARE_WRITE, SA, OPEN_EXISTING, 0, 0)

hPortP = New IntPtr(hPort) 'convert Integer to IntPtr
outFile = New FileStream(hPortP, FileAccess.Write, False) 'Create FileStream using Handle
Dim fileWriter As New StreamWriter(outFile)
fileWriter.Write("^XA^FO50,50^A030,30^FD ZEBRA^FS")

This gives me this

'Public Sub New(handle As System.IntPtr, access As System.IO.FileAccess)' is obsolete: 'This constructor has been deprecated. Please use new FileStream(SafeFileHandle handle, FileAccess access) instead.

When I use SafeFileHandle in XP I can print but in Win 7 I get this

{"Invalid handle.Parameter name: handle"}

Here is my code

Public Structure SECURITY_ATTRIBUTES
Private nLength As Integer
Private lpSecurityDescriptor As Integer
Private bInheritHandle As Integer
End Structure

Public Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As SafeFileHandle

Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" ( _
ByVal lpFileName As String, _
ByVal dwDesiredAccess As Integer, _
ByVal dwShareMode As Integer, _
<marshalas(unmanagedtype.struct)> ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDisposition As Integer, _
ByVal dwFlagsAndAttributes As Integer, _
ByVal hTemplateFile As IntPtr) As SafeFileHandle


Dim COMPORT As String
Dim hPort As SafeFileHandle
Dim SA As SECURITY_ATTRIBUTES
Dim outFile As FileStream
COMPORT = "COM4"
hPort = CreateFile(COMPORT, GENERIC_WRITE, FILE_SHARE_WRITE, SA, OPEN_EXISTING, 0, 0)
outFile = New FileStream(hPort, FileAccess.Write, 8, False)
Dim fileWriter As New StreamWriter(outFile)
fileWriter.Write("^XA") ' Start format
the invalid handle is hPort. Does anyone have an answer and how to correct? TIA
Ed Mee

AnswerRe: Visual Basic 2010 printing on a Zebra via serial port Pin
Dave Kreskowiak19-Apr-11 13:38
mveDave Kreskowiak19-Apr-11 13:38 
GeneralRe: Visual Basic 2010 printing on a Zebra via serial port Pin
EdMee21-Apr-11 11:40
EdMee21-Apr-11 11:40 
GeneralRe: Visual Basic 2010 printing on a Zebra via serial port Pin
Dave Kreskowiak21-Apr-11 12:05
mveDave Kreskowiak21-Apr-11 12:05 
QuestionConvert From Vb.Net 2008 To Vb.Net2010 [DMO Problem] Pin
Paramu197318-Apr-11 5:23
Paramu197318-Apr-11 5:23 
AnswerRe: Convert From Vb.Net 2008 To Vb.Net2010 [DMO Problem] Pin
Simon_Whale18-Apr-11 5:33
Simon_Whale18-Apr-11 5:33 
JokeRe: Convert From Vb.Net 2008 To Vb.Net2010 [DMO Problem] Pin
Andy_L_J24-Apr-11 1:52
Andy_L_J24-Apr-11 1:52 
QuestionLogin Project Help... Pin
dzhello18-Apr-11 4:01
dzhello18-Apr-11 4:01 
AnswerRe: Login Project Help... Pin
Dave Kreskowiak18-Apr-11 4:38
mveDave Kreskowiak18-Apr-11 4:38 
AnswerRe: Login Project Help... Pin
Simon_Whale18-Apr-11 5:31
Simon_Whale18-Apr-11 5:31 
QuestionProject Help! Pin
Member 784273314-Apr-11 16:15
Member 784273314-Apr-11 16:15 
AnswerRe: Project Help! Pin
Luc Pattyn15-Apr-11 0:17
sitebuilderLuc Pattyn15-Apr-11 0:17 
AnswerRe: Project Help! Pin
_Erik_18-Apr-11 3:19
_Erik_18-Apr-11 3:19 
Questionvisual basic data report Pin
sandeepkumardadwal11-Apr-11 19:30
sandeepkumardadwal11-Apr-11 19:30 
AnswerRe: visual basic data report Pin
Abhinav S11-Apr-11 21:00
Abhinav S11-Apr-11 21:00 
AnswerRe: visual basic data report Pin
thatraja12-Apr-11 18:36
professionalthatraja12-Apr-11 18:36 
QuestionBest way to return class at runtime - based on value Pin
DeepToot7-Apr-11 7:23
DeepToot7-Apr-11 7:23 
AnswerRe: Best way to return class at runtime - based on value Pin
Ali Al Omairi(Abu AlHassan)7-Apr-11 11:16
professionalAli Al Omairi(Abu AlHassan)7-Apr-11 11:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.