|
Hi guys, i need help on my symbol mc1000 barcode scanner.
I would like to create an ascii file and store the scanned barcode (decoded) in that ascii file, together with the system date as i scan a barcode. the ascii file will then be downloaded to a pc for further processing.
Any help would be very much appreciated. Thanks.
|
|
|
|
|
jayv01 wrote: i need help on my symbol mc1000 barcode scanner.
I would like to create an ascii file and store the scanned barcode (decoded) in that ascii file, together with the system date as i scan a barcode. the ascii file will then be downloaded to a pc for further processing.
Write a form that will accept a text input and scan the bar code. You should now have the scanned data in the text box - write it out with the system date to file, and clear text box.
A bar code scanner is usually a keyboard wedge - it imitates a keyboard.
HTH
|
|
|
|
|
Hi ChandraRam,
Thanks for your reply. But the barcode scanner that i am using is not a keyboard wedge but a standalone barcode scanner. Basically, the scanning of barcodes will be done by batch and will just save the data in the scanner (Symbol MC1000). Once done, I will download the ascii file from the barcode scanner to the user computer for more processing.
Sandz
|
|
|
|
|
Hi All!
I need to have drag events on a webbrowser control that it does not currently provide, I've googled this, but can't seem to find a clear answer. Does anybody have any ideas on this?
Thanks!
MrWolfy
|
|
|
|
|
|
Hi and Thanks!
Thanks for the link! Problem Solved!
Thanks Again!
MrWolfy
|
|
|
|
|
|
hai all,
i am new to vb.i am using visual basic 6.0.
back end is microsoft access.
i want to get the datas from microsoft access database and list that datas in combobox or listbox.how to do this?...thanks in advance to all...
|
|
|
|
|
Where to begin?
- You need to buy a book on programming.
- You need to move to VB.NET, vb6 has been dead for several years
- You need to write some code and post it here when it doesn't work
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hey ediet,;;;; i think you dont know anything about vb. i know want to buy book or not .
|
|
|
|
|
dileep.arangod wrote: hey ediet,;;;; i think you dont know anything about vb. i know want to buy book or not .
And I think you lack manners. The idea of CP is you write some code, and when it errors you post the code. At this point someone will try to help you.
1. If you do not know how to connect to a database and populate a list box then your understanding of vb is obviously very limited. This sort of code is very basic and therfore if you don't know the basics a book is the best bet.
2. Micrsoft stopped supporting VB6 several years ago, you can get the express version of VB 2008 free, so why bother using VB6?
Finally, if i am the ediet (idiot?) why is it you asking the question, not me.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
ok, thank you...Now your keeping manners. thanks for given the correct spell of "idiot".........bye
|
|
|
|
|
Hiii
rs.openrecordset("Select MyDate from MyTable")
for i=0 to rs.Eof
combobox1.items.add(rs!MyDate)
next
May be this helps you.
Thanx
Khatri Mitesh
|
|
|
|
|
I am trying to find a way to divide an image into equally squares. More precisly I would like to take the parts of the picture and place them in seperate picture boxes
|
|
|
|
|
I currently have a project regarding com port and i am new to serial port function. Is there anyone with example regarding this area??
|
|
|
|
|
Subjugate wrote: Is there anyone with example regarding this area
Yep. Google.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Start a project in VB, and add the component: MScomm Control.
Copy the icon of a telephone onto a form, then write some code to enable the COM port like:
MSComm1.Settings = "9600,n,8,1"
MSComm1.ParityReplace = ""
On Error GoTo COMerr
MSComm1.PortOpen = True
Exit sub
COMerr:
msgbox "A COM error occured:" & err.number & vbcrlf & err.description
End Sub
To send data out the COM port use:
MSComm1.Output = "This text string will go out the COM port."
To trap received data on the serial port, you must add this to the MScomm1.OnComm event:
dim TCin as string
if MSComm1.CommEvent = MSCOMM_EV_RECEIVE then
TCin = MSComm1.Input
msgbox Received: " & TCin
end if
You should also include these in a declarations file:
'--- MSComm event constants
Global Const MSCOMM_EV_SEND = 1
Global Const MSCOMM_EV_RECEIVE = 2
Global Const MSCOMM_EV_CTS = 3
Global Const MSCOMM_EV_DSR = 4
Global Const MSCOMM_EV_CD = 5
Global Const MSCOMM_EV_RING = 6
Global Const MSCOMM_EV_EOF = 7
'--- MSComm error code constants
Global Const MSCOMM_ER_BREAK = 1001
Global Const MSCOMM_ER_CTSTO = 1002
Global Const MSCOMM_ER_DSRTO = 1003
Global Const MSCOMM_ER_FRAME = 1004
Global Const MSCOMM_ER_OVERRUN = 1006
Global Const MSCOMM_ER_CDTO = 1007
Global Const MSCOMM_ER_RXOVER = 1008
Global Const MSCOMM_ER_RXPARITY = 1009
Global Const MSCOMM_ER_TXFULL = 1010
|
|
|
|
|
Hello everybody,
I'm new to VB 2008 and need some advice on formatting of different data types in a list box. The result is confusing for me, but still I guess it's easy for someone with more experience.
The retrieved values seem to be positioned well, as I figure when I see that the 100th value - a string - gives me the expected (readable) result. But - trying and studying and trying and searching sources - I can't find out how to format the DWORD and BYTE Types so that they show me correct results in my list box... EDIT: As I just found out, it's important to mention that the file(s) header use BIG-ENDIAN order while I'm working on a PC.
I'm afraid I'm messing up several issues At least it seems to be the completely wrong way to just "ToString" the resulting variables..
Result examples:
- A file of 8.302.592 bytes shows me a filesize of "11566592" (and maybe that's even the size stamp in the header? I really can't tell..).
- A TimeCode of 06:00:42:11 shows "289538054"
Do I probably miss any transformation issues? Or is something generally wrong wit my code? How can I format these values properly to be a readable format???
Here's what I do:
In a small project class I use a binary reader to read the header of a bitmap file into variables of data types BYTE and DWORD (which is obviously UInt32 in VB?).
</code>
'Variables (excerpt):
Dim hByte As Byte = Nothing
...
Dim hDWORD As UInt32 = Nothing
</code>
The Header is read with statements like:
<code>
'Read the header (excerpts):
hString = br.ReadChars(4)
.pictype = hString
hDWORD = br.ReadUInt32
.fileoffset = hDWORD
'...(etc)
hDWORD = br.ReadUInt32
.TimeCode = hDWORD
</code>
With the resulting variables I fill a listbox:
<code>
With lstBox
.Items.Clear()
.Items.Add("PicType: " & struct.pictype )
.Items.Add("ImageOffset: " & struct.offset) 'DWORD
.Items.Add("File Size: " & struct.fileSize.ToString & " bytes") 'DWORD
.Items.Add("Version: " & struct.version)
.Items.Add("SMPTE TimeCode: " & tv.TimeCode.ToString) 'DWORD
...
End With
</code>
Could someone please help me jump over that hurdle?
Thank you, kind regards
Michael
<div class="ForumMod">modified on Tuesday, September 23, 2008 2:29 AM</div>
|
|
|
|
|
Hi Michael,
So lets see if I get this straight:
Michael Schäuble wrote: hDWORD = br.ReadUInt32
.TimeCode = hDWORD
You read certain bits from the file into a variable of type Int32 and then you assign it to .TimeCode
I am going to have to assume that .TimeCode is a property of a class (tv ?) that you wrote yourself, and that the type of this property is int32.
In the listbox you get the value back from this property with ToString. ToString indeed just returns the string representation of your int32 value.
In other words, you'll have to convert the int32 value you got from the file to a DateTime value first in your tv class, before you use ToString("mmss") to show the string representation of the time value.
Same goes for all other similar conversions.
Hope this helps you,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thank you Johan,
you got it straight, and you recognized that I'm struggling with the data types Perhaps it helps if I explain a bit better, but due to my still lacking capabilities please excuse (or correct) any errors:
I'm trying to read/write the header of a dpx (picture) file which has a fixed structure. Following the SMPTE definition, many values (e.g. "tv.timecode") are stored in a DWORD (which would be UInt32 in VB). And when I examine the timecode-position in a HEX-Editor, I see the Bytes "06-00-42-11" stored for the timecode "06:00:42:11". Btw: Since it's stored big-endian, meanwhile I wrote a function to swap the bytes first (there really doesn't seem to be a VB standard function), so the line now is
hDWORD = SwapDWORD(br.ReadUInt32)
.TimeCode = hDWORD while the "buffer variable" hDWORD is still UInt32 and converted afterwards in a listbox:
.Items.Add("SMPTE TimeCode: " & CDate(tv.TimeCode)) Unfortunately VB doesn't let me convert to what I need (and you suggest), so the above line throws an error saying "UInt can't be converted to DateTime" (as far as I read this would need Double / 8 bytes). A "CTime" function doesn't seem to be available. Still I have only 4-bytes...
Where's that big tomato on my eyes???
|
|
|
|
|
In addition, one more formatting question arose:
The definition says that undefined fields (except ASCII) are "to be initialized to their 'all one' values" (then they give the example code for C: 'WORD val = ~0;'). These fields are BYTE, WORD, DWORD and SINGLE types.
Therefore, from these fields I retrieve the highest possible values as decimals (e.g. 4294967295 for the DWORD / UInt32) and would like to show them as "n.def" in the list field. Obviously I can't store a value like "n.def" in the buffer variable (hDWORD = UInt32, hWORD = UInt16 etc.) which is then assigned to the stored variable (e.g. 'tv.framenumber'). So I'm afraid having to write If-statements for hundreds of entries.
Do you know a more elegant way to show "n.def" in such a case in the VB list field?
|
|
|
|
|
|
Sorry, Johan - so you see it's even hard for a beginner to express clear enough Another try ... and still thank you for your patience:
1. The binary reader reads a value from the file header, the Bytes are swapped (due to big-endian) and the result assigned to a re-usable 'buffer variable' of the relevant size (e.g. hDWORD as UInt32 for a DWORD)
hDWORD = SwapDWORD(br.ReadUInt32)
2. This 'buffer variable' is then assigned to one of the specific variables I have to set (e.g. 'data.offset')
.offset = hDWORD
3. Then step 1 is repeated to read the next DWORD, for which hDWORD is assigned to another specific variable (e.g. 'file size')
Problem: Sometimes the fields in the file (e.g. 'file size') are not set for any reason. In that case, due to header specification, they are 'FFFF FFFF' (DWORD field) or 'FFFF' (WORD field) and result in large decimals (maximum possible value) when reading them.
Goal: If the read value is 'FFFF FFFF' then show 'undefined' in a list box
Was I more understandable this time? Hoping ...
modified on Thursday, September 25, 2008 8:09 AM
|
|
|
|
|
That was more my speed
The problem seems simple enough (just discussing) you read the value, which will be somewhere between Int32.MinValue and Int32.MaxValue or if the value is FFFF FFFF then it is Int32.MaxValue
So a simple function like:
Private Function OverTheMax(ByVal i32 As Int32) As String
Try
If i32 = Int32.MaxValue Then
Return i32.ToString
Else
Return "Weiss ich nicht !"
End If
Catch ex As Exception
MsgBox(ex.ToString)
Return "Error"
End Try
End Function
should take care of things, and no hundreds of If sentences... ?
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi Johan, that sounds like a good solution - at first sight.
With your function I'd only have to change the second line of my (hundreds of) property-reading statements, right?
hDWORD = SwapDWORD(br.ReadUInt32)
.fileSize = OverTheMax(hDWORD)
Some important things make me hesitate:
- My property variables (e.g. '.fileSize') are different types (Byte, Int16, Int32, Single etc.) depending on their purpose. I'd have to re-write your function different (the 'ByVal'-part) for every type, no?
- Plus: For each and every value a data type 'string' is returned, so that I would have to declare all the property variables as string types first, and then re-convert each one to what it was before, using another property variable of the correct type.
I'm not sure if the rewards of 'nicer looks' is worth the cost? What do you think?
Thanks
Michael
|
|
|
|