Page 1 of 2 12 LastLast
Results 1 to 40 of 49

Thread: [RESOLVED] Ascii string decoding

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Resolved [RESOLVED] Ascii string decoding

    Hi All

    I have created a data matrix barcode (values differ depending on sql record returned), and when i scan into notepad++ i get:

    [)>RS06GSP12345GSQ100GSK50023098GSRSEOT

    However scanning into a textbox in my visual studio 2019 app I get:

    [)>06P12345Q100K50023098

    The barcode has been designed to include record separators (RS) and group separators (GS) and these can be seen in notepad++, however threy are not present when the barcode is scanned into a textbox!! I have a customer requirement and i am totally baffled how to get the GS and RS to show in some shape or form so i can separate the text into the various data it contains.

    Any help would be appreciated!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Ascii string decoding

    I don't see how we could possibly answer that question with the little information you have provided. Please provide a FULL and CLEAR explanation of the problem. All we can really tell you is that you have done something wrong but, with no idea what you've actually done, we can't tell you what's wrong with it.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Hi "jm"

    Not sure what else i can tell you! I have created a barcode within a popular software, printed the label, opened the app amd for arguement sake lets say it has one text box.

    I click on the textbox so the focus is on that textbox, scan the label and get a a reading without the RS which is a space amd the GS. What i want is some piece of code that i can include which includes the ascii charecters or at least shows me in some shape or form where the GS / RS / EOT are.. not sure what else I can add, as you cant go wrong simply placing a textbox!

    Thanks for your time.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Ascii string decoding

    Is there a null character in the string (chr(0))? That would truncate your text in a textbox...

  5. #5
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Ascii string decoding

    Seems similar to this other fairly recent thread, it might help.

    https://www.vbforums.com/showthread....ith-Separators

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Ascii string decoding

    Are those RS and GS instances actually R, G and S ASCII characters or are they something else that doesn't actually have a visual representation?

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Ascii string decoding

    Quote Originally Posted by OptionBase1 View Post
    Seems similar to this other fairly recent thread, it might help.

    https://www.vbforums.com/showthread....ith-Separators
    That thread was created by the same member as this one.

  8. #8
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Ascii string decoding

    It is entirely possible that it's simply how the TextBox chooses to render text when these characters are present:-


    The above image shows a TextBox's input which was generated by this code:-
    vbnet Code:
    1. '
    2.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    3.  
    4.         Dim s As String = ChrW(29) + "AB" + ChrW(30) + "C"
    5.  
    6.         TextBox1.Text = s
    7.  
    8.         Debug.WriteLine(TextBox1.Text)
    9.  
    10.     End Sub

    Notice that the TextBox completely ignores the GS and RS characters but the debugger doesn't. This suggests that the characters are in the String and the TextBox is simply choosing not to display them. However, do not assume this is what is happening in your case. The Barcode scanner is inputting these characters directly into the TextBox where as I am setting the Text property. For all we know when these characters are being inputted, they are ignored. You will have to test TextBox.Text yourself to see if the characters are actually in the String if they were input from the barcode scanner.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  9. #9
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Ascii string decoding

    Quote Originally Posted by jmcilhinney View Post
    Are those RS and GS instances actually R, G and S ASCII characters or are they something else that doesn't actually have a visual representation?
    No. They are special ASCII characters being inputted by the Barcode scanner:-


    It can be inferred from the OP's post that NotePad++ chooses to render them as RS, GS etc. but they are actually non-printable characters.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  10. #10
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Ascii string decoding

    Quote Originally Posted by jmcilhinney View Post
    That thread was created by the same member as this one.
    LOL...oops.

  11. #11

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Thank you for your responses guys.

    @Paul - I don't think there are null charecters, will double check though.
    @Niya - Good test and spot, thank you! Will try this and get back to you.

    Yes, it was myself who started the other thread, I marked it as complete as it gave me what I wanted at the time. As per that thread, I replaced all the GS with RS which gave me a the "space" charecter which i was then able to use to break the string apart. However subsequently been told the approved barcode contains GS and this is what will be scanned.

    Thank you for your time.

  12. #12

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Hi @Niya

    How did you get what appears to be a drop down with immediate window and the "debug" value? I have a group of tabs at the bottom, one of which is immediate window but I don't think it's that.
    Thank you in advance

  13. #13
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Ascii string decoding

    Depending on the settings, Debug.WriteLine will either write to the Immediate window, which is the one you are looking at. Sometimes, I have to scroll up in the window to see what was printed initially.
    But the IDE can also be set to have Debug.WriteLine write to the Output window. So, look at your Output window to see if the debug output is going there.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  14. #14

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Quote Originally Posted by passel View Post
    But the IDE can also be set to have Debug.WriteLine write to the Output window.
    - thank you "Passel", that's exactly where it was.
    Will scan the barcode at work tomorrow and then check the output window, here is hoping it contains the decoded values.

    I copied the value I got within notepad ++ into the code where I was setting the value of the textbox (via variable s - see previous posts) and I could see the group and record separators.

    My question I guess is when I start the application tomorrow and scan the barcode into textbox one, will the resulting value appear in the output, just looking at above if it is at debug time then this would have already passed.
    Will update tomorrow, but least I can see record separators and group separators within visual studio which is a plus.

    I am then hoping the values I see in the output window can be "passed" into another textbox (textbox2) from which I can then split out the various data. Thanking you all for your time thus far.
    Last edited by AMJADJ75; Nov 29th, 2020 at 06:25 PM.

  15. #15
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    I am then hoping the values I see in the output window can be "passed" into another textbox (textbox2) from which I can then split out the various data.
    No, no, no. You're missing the point. The fact that the TextBox is not displaying those characters doesn't mean that they aren't there. The Text of the TextBox is a String and that String still contains those characters and it is that String that you need to work with. If the character is there then you can spit on it, whether you can see it in the UI or not.

  16. #16

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    I get the fact that just because it does not display them does not mean they are not there! But if my textbox is showing [)>06P12345Q100K50023098

    So before the first P I should have a group seprator and another before the Q. Therefore the charecters between P+1 and Q-1 will give me my part number. I cant use the Q in case my part number ends with a Q, so of i cant physically see a charecter representing the group seprator, i cannot tell where each data set begins and ends. Hence why I was hoping I can push the a string with the charecters representing GS and RS into another textbox....

    Thank you for your time

  17. #17
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    I get the fact that just because it does not display them does not mean they are not there!
    Apparently you don't because, if you did, you wouldn't have said this:
    Quote Originally Posted by AMJADJ75 View Post
    But if my textbox is showing [)>06P12345Q100K50023098

    So before the first P I should have a group seprator and another before the Q. Therefore the charecters between P+1 and Q-1 will give me my part number. I cant use the Q in case my part number ends with a Q, so of i cant physically see a charecter representing the group seprator, i cannot tell where each data set begins and ends.
    Of course you can tell. You don't have to be able to see them to write code to use them. The Text of the TextBox is a String. Get that String and call IndexOf to get the indexes of the characters you're interested in and then use Substring to get the text between those indexes. You already know what the ASCII codes are for those separator characters so you already have everything you need.
    vb.net Code:
    1. Dim groupSeparator = Convert.ToChar(29)
    2. Dim recordSeparator = Convert.ToChar(30)
    3. Dim barcode = myTextBox.Text
    4. Dim recordSeparatorIndex = barcode.IndexOf(recordSeparator)
    5. Dim groupSeparatorIndex = barcode.IndexOf(groupSeparator)
    6. Dim partNumberIndex = recordSeparatorIndex + 1
    7. Dim partNumberLength = groupSeparatorIndex - recordSeparatorIndex - 1
    8. Dim partNumber = barcode.Substring(partNumberIndex, partNumberLength)

  18. #18

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Thank You JM.

    I have now performed the testing and I am afraid it is back to square one (as I was with my previous thread) here is a summary:

    -- > When I scan the barcode into notepad ++, I am seeing both group and record separators
    -- > When I copy this data from notepad ++ into my application's code (assigning a variable) I can see the group and record separators
    -- > When I scan the barcode into textbox1 and then pass the text in this to write line to debug, I can only see record separators, which explains why I had changed all GS to RS in my previous post.

    When I scan the barcode using the same scanner in two other applications (notepad ++ and a internal software) I am getting both RS and GS therefore, I think it is fair to say it is not the scanner? This is just baffling me!
    Visual studio recognises Group Separators When hard coded but not when scanned into a textbox

    Any assistance would be massively appreciated.

  19. #19
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    Thank You JM.

    I have now performed the testing and I am afraid it is back to square one (as I was with my previous thread) here is a summary:

    -- > When I scan the barcode into notepad ++, I am seeing both group and record separators
    -- > When I copy this data from notepad ++ into my application's code (assigning a variable) I can see the group and record separators
    -- > When I scan the barcode into textbox1 and then pass the text in this to write line to debug, I can only see record separators, which explains why I had changed all GS to RS in my previous post.

    When I scan the barcode using the same scanner in two other applications (notepad ++ and a internal software) I am getting both RS and GS therefore, I think it is fair to say it is not the scanner? This is just baffling me!
    Visual studio recognises Group Separators When hard coded but not when scanned into a textbox

    Any assistance would be massively appreciated.
    To verify what is in the textbox

    Code:
            Debug.WriteLine("---------------------")
            For Each c As Char In TextBox1.Text
                Dim s As String
                s = String.Format("Char: {0} Ascii code: {1}", c, Asc(c))
                Debug.WriteLine(s)
            Next
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  20. #20

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Attachment 179434

    Please see attached for outcome, it can be seen, when scanning directly into the textbox the GS are not there but when the text from notepad++ is copied into the textbox the GS are present (arrow)
    hope this makes sense - thank you for your time in replying.

  21. #21
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    Attachment 179434

    Please see attached for outcome, it can be seen, when scanning directly into the textbox the GS are not there but when the text from notepad++ is copied into the textbox the GS are present (arrow)
    hope this makes sense - thank you for your time in replying.
    I can't view the attachment. You could just copy the output from the debug and paste it here.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  22. #22

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Of course, i will do so tomorrow when I am back at work, but will try to explain in case you understand it this way..

    So when i scan in notepad++ i get: [)>RS06GSP12345GSQ100GSK50023098GSRSEOT
    When I copy this into the textbox and write to debug, the RS above are replaced with the triangle pointing up and GS by <->
    However when i scan the barcode i to textbox one, the debug shows RS above replaced by the triangle but there is no <-> for GS.

    The normal charecters are shown on each line.
    Thank you

  23. #23
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    Of course, i will do so tomorrow when I am back at work, but will try to explain in case you understand it this way..

    So when i scan in notepad++ i get: [)>RS06GSP12345GSQ100GSK50023098GSRSEOT
    When I copy this into the textbox and write to debug, the RS above are replaced with the triangle pointing up and GS by <->
    However when i scan the barcode i to textbox one, the debug shows RS above replaced by the triangle but there is no <-> for GS.

    The normal charecters are shown on each line.
    Thank you
    What is the exact make and model of scanner?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  24. #24

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Quote Originally Posted by dbasnett View Post
    What is the exact make and model of scanner?
    Datalogic, Model - Quickscan QM2400
    I dismissed the scanner as 2 other software picked up the GS and RS with the same scanner.
    Thank you for your time.

  25. #25
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    How is it connected to the PC? Keyboard wedge?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  26. #26

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Quote Originally Posted by dbasnett View Post
    How is it connected to the PC? Keyboard wedge?
    The holder / charger has a wired USB, which is connected difectly into the PC.
    Really appreciate you replying and taking time out - thank you.

  27. #27
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    The holder / charger has a wired USB, which is connected difectly into the PC.
    Really appreciate you replying and taking time out - thank you.
    Did you program the scanner by scanning the Programming Bar Codes? If so what did you choose?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  28. #28

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Quote Originally Posted by dbasnett View Post
    Did you program the scanner by scanning the Programming Bar Codes? If so what did you choose?
    Yes it was but cannot remember what was selected / what the current settings are but having had a look at the manual online just now i am assuming the "USB Keyboard with alternate key encoding" would have been chosen.

  29. #29

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Would like to add / question and this is why I dismissed the scanner. We have another software developed externally specifically for us which does what I am trying to do ie scan the barcode into a textbox and then split the data out into other textboxes. Not sure what language it uses (don't think it is developed in V Studio either).

    I use the same scanner without changing the settings and exactly the same barcode but that works fine. So i thought it would be something to do with the software as opposed to the scanner.

  30. #30
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    Yes it was but cannot remember what was selected / what the current settings are but having had a look at the manual online just now i am assuming the "USB Keyboard with alternate key encoding" would have been chosen.
    For the textbox you are using handle the KeyPress event

    Code:
        Private Sub TextBox1_KeyPress(sender As Object,
                                      e As KeyPressEventArgs) Handles TextBox1.KeyPress
            Dim ch As Char = e.KeyChar
            Dim s As String
            s = String.Format("Char: {0} Ascii code: {1}", ch, AscW(ch))
            Debug.WriteLine(s)
        End Sub
    You can test the ability of the textbox to have RS and GS characters by just typing them into the textbox. They are Control characters, hold the control key and type the character.

    Code:
        Ctrl  ]	29	Group Separator
        Ctrl  ^	30	Record Separator
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  31. #31

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    I thought the ASCII characters were achieved by holding alt and typing in the code number? Anyhow, I have logged on and performed the above tests and the results are as follows:

    Keys = shift + 6 = Char: ^ Ascii code: 94
    Keys = [ = Char: [ Ascii code: 91
    Keys = fn+alt + 29 = Char: â—‹ Ascii code: 9675

    So this made me think about the codes it is returning so I did another test:

    Code:
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim s As String = ChrW(29) + "AB" + ChrW(30) + "C"
            TextBox1.Text = s
            Debug.WriteLine(TextBox1.Text)
        End Sub
    character 29 brought back something like an arrow with two heads <->
    character 30 brought back coloured triangle pointing up

    However when I copy both symbols into textbox one individually, using your code, the debug line says I have typed in Char: (T slightly lower) Ascii code: 22 for both.... :confused

  32. #32
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    I thought the ASCII characters were achieved by holding alt and typing in the code number? Anyhow, I have logged on and performed the above tests and the results are as follows:

    Keys = shift + 6 = Char: ^ Ascii code: 94
    Keys = [ = Char: [ Ascii code: 91
    Keys = fn+alt + 29 = Char: â—‹ Ascii code: 9675

    So this made me think about the codes it is returning so I did another test:

    Code:
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim s As String = ChrW(29) + "AB" + ChrW(30) + "C"
            TextBox1.Text = s
            Debug.WriteLine(TextBox1.Text)
        End Sub
    character 29 brought back something like an arrow with two heads <->
    character 30 brought back coloured triangle pointing up

    However when I copy both symbols into textbox one individually, using your code, the debug line says I have typed in Char: (T slightly lower) Ascii code: 22 for both.... :confused
    With the code I posted type
    Ctrl ] for Group Separator (29)
    Ctrl ^ for Record Separator(30)

    That is holding the Ctrl key and the specified character simultaneously.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  33. #33

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    sorry mate, I went into "stupid" mode!! been a long day, nearly bedtime!!

    I have pressed ctrl ] and I get Char:  Ascii code: 29...….. (Char: <-> Ascii code: 29)…… my ^ is on the number 6 key, pressing ctrl + 6 brings nothing back.
    Again - thank you ever so much for your time, I can't thank you enough.
    This is what I am not getting when I scan my barcode into textbox 1, but I get the ascii code 30 (Record Separator).
    Last edited by AMJADJ75; Nov 30th, 2020 at 05:34 PM.

  34. #34
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Ascii string decoding

    Quote Originally Posted by AMJADJ75 View Post
    ... my ^ is on the number 6 key, pressing ctrl + 6 brings nothing back...
    The ^ is on the 6 key. You don't press 6 to get the ^ symbol you press Shift-6 to get it. So Ctrl-^ would logically be Ctrl-Shift-6.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  35. #35

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Yes that has worked... Shift + CTRL + 6 reads back ascii code 30 (coloured triangle pointing up)
    But as above, i got this ascii code when scanning the barcode into textbox1 but not 29 (group separator)
    Thank you for your time and assistance.

  36. #36
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    What was the debug output from the keypress event when you scan?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  37. #37

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Quote Originally Posted by dbasnett View Post
    What was the debug output from the keypress event when you scan?

    [ ) > ^ 0 6 P F T E S T C O M P O N E N T Q 5 0 0

    Before the P there should be a group separator and also before the Q there should be one. When I copy the notepad ++ text into the textbox I get the group separators here (<->)
    Thank you

  38. #38
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    That isn't the output from the keypress event when you scan. I gave you the code.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  39. #39

    Thread Starter
    Member
    Join Date
    Oct 2020
    Location
    UNITED KINGDOM
    Posts
    59

    Re: Ascii string decoding

    Quote Originally Posted by dbasnett View Post
    That isn't the output from the keypress event when you scan. I gave you the code.
    I entered your code,started the application, scanned the barcode and then within the output tab albeit going downwards i got one character at a time which the above is part of. I can give you every charecter it came with along with the ascii codes etc tomorrow when i am at work. I guess the point i was trying to make was the group separator ascii code / symbol was not present, but the record separator was. Sorry for being a pain i am not that much of an expert.

  40. #40
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Ascii string decoding

    Yes, post all of the debug output.

    You should also try this event
    Code:
        Private Sub TextBox1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles TextBox1.PreviewKeyDown
            Dim s As String
            s = String.Format("KeyCode: {0}  KeyData: {1}  KeyValue: {2}  Modifiers: {3}  ",
                                e.KeyCode, e.KeyData, e.KeyValue, e.Modifiers)
            Debug.WriteLine(s)
        End Sub
    My guess is that there is a timing issue with VB and the scanner.
    Last edited by dbasnett; Dec 3rd, 2020 at 09:31 AM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width