|
|
Hello !
I have an application on vb.net 2013.
Is there any way , or some library that I can use to read from Barcode Readers (USB) ?
Thank you !
|
|
|
|
|
It depends on the information provided by the barcode reader. Check the documentation for the device, and see if the manufacturer provides a programming API.
|
|
|
|
|
If you have a barcode-scanner with an USB-connector, it will have keyboard-emulation. Meaning, it will send key-press-events to your application as if you entered something via keyboard. You can verify that by opening just any word-processing application and scanning a barcode. It should appear as if entered via keyboard.
So all you would have to do is to ensure that some text-input-control has the input-focus before attempting to scan something and then process it like any text-input.
Theoretically there are ways to directly read it from the barcode-scanner so that you don't have to have that text-input-control but that would be way more advanced. If you want to take a look at that anyway, I can serve you only with an article that does this with C#:
Using Raw Input from C# to handle multiple keyboards[^]
Edit: Some manufacturers also provide APIs for their barcode scanners which would provide a third way to do this. I haven't dabbled with any of those yet because it would mean to restrict the range of barcode scanners my application would be able to work with.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Good day friends! I have been wondering on how I can create my own installer from scratch in vb6.0 without using deployment wizard or any third party app. Any suggestion is welcome.
|
|
|
|
|
Thought it's possible, I highly recommend you don't.
First, in order for the VB6 "installer app" to work, you have to make sure the VB6 runtimes are installed. VB6 code will not run at all without them.
Seriously, use an installation creation tool like InnoSetup or Advanced Installer or whatever. Don't try to "roll your own", even more so considering you even asked this question to begin with. It tells us that you have no idea what you're doing or how complicated this is going to be.
Lastly, why are you even using VB6? It's been dead for quite a long time now. VB.NET is free for the Express or Community editions. The Community edition can be found here[^].
|
|
|
|
|
Use Install Sheild 2010. It is best. But leave vb6.0 and move to vb.net or c#.
|
|
|
|
|
<pre lang="VB.NET">Try
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
MyConnection = New System.Data.OleDb.OleDbConnection _
("provider=Microsoft.Jet.OLEDB.4.0;" _
" Data Source = 'c:\testfile.xls'; " _
"Extended Properties=Excel 8.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter _
("select * from [Sheet1$]", MyConnection)
MyCommand.TableMappings.Add("Table", "TestTable")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGridView1.DataSource = DtSet.Tables(0)
MyConnection.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try</pre>
|
|
|
|
|
You can't split the string with the _ characters like that. If you want to spread that over several lines then introduce a variable e.g.
Dim ConnectionString As String = "provider=Microsoft.Jet.OLEDB.4.0;"
ConnectionString += " Data Source = 'c:\testfile.xls'; "
ConnectionString += "Extended Properties=Excel 8.0;"
MyConnection = New System.Data.OleDb.OleDbConnection(ConnectionString)
|
|
|
|
|
HELLO net programers, i have problem to display marker Point on Digital Maps (format shapefile). Can you help me guys ?
i hope so
Thanks,
|
|
|
|
|
What have you tried? Where are you stuck?
|
|
|
|
|
I am developing a sample project in Visual basic 6 and MS Access 2003.
1. I wish to print Invoice in Continuous statonery (Roll Paper ) width of paper 5.5 inches
I am printing CRYSTAL Report 8.5 report in Roll paper (Continuous Stationery)
My problem , after printing one bill printer skips and giving lot of space between two bills. My aim printer must stop printing after completing one bill. ( no gaps required ) and user tear off that bill and continue to print next bill.
I am printing invoice in DOT MATRIX PRINTER (USB )
My code is
BILLPRINT.DiscardSavedData
BILLPRINT.Database.SetDataSource rs
crviewerbill.ReportSource = BILLPRINT
crviewerbill.Zoom (100)
BILLPRINT.ReportTitle = "BILL"
BILLPRINT.txtdue.SetText "" & custdue & ""
BILLPRINT.PrintOut False
|
|
|
|
|
Crystal Reports doesn't support printing on continuous paper.
|
|
|
|
|
I am developing a sample project in Visual basic 6 and MS Access 2003.
1. I wish to print Invoice in Continuous statonery (Roll Paper ) width of paper 5.5 inches
I am using printer.print Code using (x,y) co-ordinates
My problem , after printing one bill printer skips and giving lot of space between two bills. My aim printer must stop printing after completing one bill. ( no gaps required ) and user tear off that bill and continue to print next bill.
I am printing invoice in DOT MATRIX PRINTER (USB )
My code is
Dim cy As Long
Dim cx As Long
Dim cx1 As Long
Dim tmpval As Double
Set rs = New ADODB.Recordset
sql = "select * from del_head where tran=" & Trim(txtcustno.Text) & ""
rs.Open sql, CN, adOpenStatic, adLockPessimistic
If rs.RecordCount > 0 Then
cno = rs(2)
custname = rs(3)
ctown = rs(8)
Set rs3 = New ADODB.Recordset
rs3.Open "select sum(amountdue)-sum(amountrec) from receipt_d where cid = " & cno & "", CN, adOpenStatic, adLockPessimistic
custdue = rs3(0)
rs3.Close
Printer.Font = "Arial"
Printer.FontBold = True
Printer.FontSize = 12
Printer.CurrentX = 3400
Printer.CurrentY = 50
Printer.Print " XXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 10
Printer.CurrentX = 3400
Printer.CurrentY = 350
Printer.Print " XXXXXXXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 11
Printer.CurrentX = 2600
Printer.CurrentY = 650
Printer.Print " XXXXXXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 11
Printer.CurrentX = 3300
Printer.CurrentY = 950
Printer.Print " XXXXXXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 9
Printer.CurrentX = 6400
Printer.CurrentY = 50
Printer.Print " XXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 9
Printer.CurrentX = 6400
Printer.CurrentY = 200
Printer.Print " : XXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 9
Printer.CurrentX = 6350
Printer.CurrentY = 550
Printer.Print " XXXXXXXXXXXXXXXX"
Printer.CurrentX = 1000
Printer.CurrentY = 1150
Printer.FontSize = 9
Printer.Print " Bill No : " & rs(1)
Printer.CurrentX = 3600
Printer.CurrentY = 1150
Printer.FontSize = 8
Printer.Print " INVOICE "
Printer.CurrentX = 6150
Printer.CurrentY = 1150
Printer.FontSize = 9
Printer.Print " Date : " & rs(4)
Printer.Line (1000, 1400)-(7800, 1400) '-h line
'Printer.Line (20, 10)-(20, 18800) 's1
'Printer.Line (11520, 10)-(11520, 18800) 's2
'Printer.Line (10, 18800)-(11500, 18800) 'bl
Printer.Font = "DCI + Tml + Ismail"
Printer.CurrentX = 100
Printer.CurrentY = 1550
Printer.Print " tpguk; fp tpiy bjhif"
Printer.Line (1000, 1800)-(7800, 1800) '-h line
cy = 2000
cx = 6500
Set rs1 = New ADODB.Recordset
sql = "select * from del_det where transno=" & Trim(txtcustno.Text) & ""
rs1.Open sql, CN, adOpenStatic, adLockPessimistic
Do While Not rs1.EOF
Printer.Font = "DCI + Tml + Ismail"
Printer.CurrentX = 1100
Printer.CurrentY = cy
Printer.Print rs1(3)
Printer.Font = "Arial"
Printer.FontSize = 10
Printer.CurrentX = 3500
Printer.CurrentY = cy
Printer.FontSize = 9
Printer.Print rs1(4)
Printer.CurrentX = 4700 - TextWidth(rs1(5))
Printer.CurrentY = cy
Printer.Print Format(rs1(5), "00.00")
Printer.CurrentX = cx - TextWidth(rs1(6))
Printer.CurrentY = cy
Printer.Print Format(rs1(6), "00.00")
'Format$(123,"@@@@@@")
rs1.MoveNext
cy = cy + 250
Loop
Printer.Line (6000, cy)-(7800, cy) '-h line
Printer.Font = "DCI + Tml + Ismail"
Printer.CurrentX = 4500
Printer.CurrentY = cy + 100
Printer.FontSize = 10
Printer.Print " bkhj;jk; "
Printer.Font = "Arial"
Printer.CurrentX = cx - TextWidth(rs(7))
Printer.CurrentY = cy + 100
Printer.FontSize = 10
Printer.Print Format(rs(7), "00.00")
cy = cy + 300
Printer.Line (6000, cy)-(7800, cy) '-h line
Printer.Font = "DCI + Tml + Ismail"
Printer.CurrentX = 4500
Printer.CurrentY = cy + 300
Printer.FontSize = 10
Printer.Print " bkhj;j ghf;fp "
Printer.Font = "Arial"
Printer.CurrentX = cx - TextWidth(custdue)
Printer.CurrentY = cy + 300
Printer.FontSize = 10
Printer.Print Format(custdue, "00.00")
cy = cy + 600
Printer.Line (6000, cy)-(7800, cy) '-h line
Printer.EndDoc
End If
|
|
|
|
|
imagetvr wrote: I am developing a sample project in Visual basic 6 and MS Access 2003.
Why are you using VB6? It's been dead for quite a long time now.
In the .NET world, there is the PosPrinter class in the Microsoft POS for .NET library that will do what you want. No, you can't use it in your VB6 code.
The code you've written will not work because you're "printing" to a paper size. This size is required by the Printer object and cannot be infinitely long or of an undetermined size before you start printing. You have to "print" directly to the printer itself without using the Printer object. That also means you do not get to specify fonts and sizes like you have. You have to specify these things, if possible at all, by using the control characters and commands specific to the printer. See the printers documentation on how to do this.
|
|
|
|
|
I made a program, that contains two forms, one is the controls form and the other is the screen which the actions appear on it.
I use screen splitting and HDMI cable.
I make the screen 'Duplicate' option
I connect the PC with a TV, I share Form2(screen) to the tv and Form1(controls) on my PC's screen.
HERE IS MY PROBLEM!!!!
all sounds from both screens get out to the tv
but I want to split sounds or decide which sounds go to which screen either TV or PC
I have buttons that produce different types of sounds.
|
|
|
|
|
Interesting concept ... I've never come across a screen that plays sounds
|
|
|
|
|
so do you think there's a solution for it?
|
|
|
|
|
Have a look at this link[^] it might help.
Failing that, Google is your friend
|
|
|
|
|
Thank you for your effort.
and I found a program that do what I exactly needed.
it's CheVolume, which determines each application to playback on either device.
|
|
|
|
|
I'm new to await, and have always had trouble understanding it. Like I make an await function, and then VS 2013 Tells me to make the calling function await, and just keeps moving up the chain.
So this time I did some research on it.
http://stackoverflow.com/questions/14888984/start-async-task-without-using-await-in-called-method[^]
In the link above, there's 2 examples, and I found the 2nd one easier to understand.
But I'm wondering if I should use example 1 instead. What do you think?
Here's what I have. i'd like to be able to check on the status, and have it update the form with emails sent and status, if it's still running and complete, so I can change the form color back. Not sure if I'm on the right track, and wanted to check before I write more code. But so far so good, it works.
Public Enum _smtpEngine_Status
STOPPED = 1
START_PENDING = 2
STOP_PENDING = 3
RUNNING = 4
CONTINUE_PENDING = 5
PAUSE_PENDING = 6
PAUSED = 7
COMPLETE = 8
EMPTY = 9
End Enum
Public Class smtp_send_engine
'<a href="http://stackoverflow.com/questions/14888984/start-async-task-without-using-await-in-called-method">http://stackoverflow.com/questions/14888984/start-async-task-without-using-await-in-called-method</a>
Public Shared engineTask As Task
Public Shared Function engineStart( _
ByVal pSend As frmSend,
ByVal pJobID As Integer,
ByVal pPageIndex As Integer,
ByVal pPageSize As Integer) As _smtpEngine_Status
Dim pValue As _smtpEngine_Status = _smtpEngine_Status.START_PENDING
'No need for sub to be async but can be async if needed for other reasons (see below)
'but that doesn't stop the execution in the CallingSub
'Get the task started... it's not going to wait for the task to be done just sets the task variable
engineTask = engineRun( _
pSend,
pJobID,
pPageIndex,
pPageSize
)
Return pValue
End Function
Public Shared Async Sub engineStatus()
'Must be async so you can await the result
Await engineTask
'Do stuff that requires task to be done
End Sub
Private Shared Async Function engineRun( _
ByVal pSend As frmSend,
ByVal pJobID As Integer,
ByVal pPageIndex As Integer,
ByVal pPageSize As Integer) As Task(Of _smtpEngine_Status)
'No need for this function to be async since the function has no await
Dim pValue As _smtpEngine_Status = _smtpEngine_Status.START_PENDING
Dim responseCount As New crm.ws_sendEngine_subscribersCount_response
Dim dwXCode As Integer = request_sendEngine_Count.get_Subscriber_Count(responseCount)
If Not (responseCount.count > 0) Then
Return _smtpEngine_Status.EMPTY
Exit Function
Else
Await Task.Delay(30000)
pValue = _smtpEngine_Status.COMPLETE
End If
Return pValue
End Function
End Class
|
|
|
|
|
The problem with asking for an opinion is that you will probably get conflicting responses. You also have no means of determining whose response is "best" for you (lots of reputation points is no indicator of expertise in any one particular subject!)
Try them both out and see which is more appropriate to your own circumstances ... you've said you are new to the subject, so how better to learn and retain than to write that code?
One general comment that I've seen to be true more times than I care to admit - if it's simple to understand now then it will be simple to understand when you have to come back to the code days, months, years later ... this is a Good Thing.
Alternatively, ask the opinions of the posters on that other forum where you got the examples.
|
|
|
|
|
I had a really hard time getting the 2nd one to work, but it works good. So I guess I'll stick with it. And I have a better understanding of await now as well.
|
|
|
|
|
|
This was a head scratcher for me, first time I have used await. Before I was using new Thread.
Not sure what the difference is, guess I should do a search on it. But It seems to work fine so far, I still need to plugin the SMTP Message Sender, which is new Thread. Maybe I should update it to await.
I'm not sure what to do with the EngineStatus, I'd like to get the status of EngineRunAsync.
The calling function that returns from the dialog result OK or Send, and raises an event to update the form to RED color so the user knows it's running.
So this time VS 2013 did not bug me to use Await, and just the one call was fine.
Dim m_status As _smtpEngine_Status = Await smtp_send_engine.engineStart(Me, gJobID, gJobIndex, gJobSize)
RaiseEvent SendEngineStatus(m_status, "COMPLETED", gJobID)
Update_SendEngine_Status("Send Engine has completed successfully", _smtpEngine_Status.COMPLETE, gJobID)
My Class that runs in await.
Public Enum _smtpEngine_Status
STOPPED = 1
START_PENDING = 2
STOP_PENDING = 3
RUNNING = 4
CONTINUE_PENDING = 5
PAUSE_PENDING = 6
PAUSED = 7
COMPLETE = 8
EMPTY = 9
End Enum
Public Class smtp_send_engine
Public Shared engineTask As Task(Of _smtpEngine_Status)
Public Shared Async Function engineStart( _
ByVal pSend As frmSend,
ByVal pJobID As Integer,
ByVal pPageIndex As Integer,
ByVal pPageSize As Integer) As Task(Of _smtpEngine_Status)
engineTask = engineRunAsync(pSend, pJobID, pPageIndex, pPageSize)
Dim pValue As String = Await engineTask
pValue = _smtpEngine_Status.COMPLETE
Return pValue
End Function
Public Shared Async Sub engineStatus()
Await engineTask
End Sub
Private Shared Async Function engineRunAsync( _
ByVal pSend As frmSend,
ByVal pJobID As Integer,
ByVal pPageIndex As Integer,
ByVal pPageSize As Integer) As Task(Of _smtpEngine_Status)
For idx As Integer = 0 To m_pages - 1
For jdx As Integer = 0 To 25 - 1
Await Task.Delay(2500)
m_sent += 1
m_remaining -= 1
Application.DoEvents()
Next
Next
pValue = _smtpEngine_Status.COMPLETE
return pValue
End Sub
|
|
|
|
|