Results 1 to 10 of 10

Thread: barcode text_change() event

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2009
    Posts
    492

    barcode text_change() event

    I have (2) problem.

    (1) I have barcode scanner, when BEEP OK, that Text1.Text show all number.

    example: EAN13 format
    9-123456-123456

    in Text1.Text show: "9123456123456"

    How about that time, automatic changed format : "9-123456-123456" ?

    where do begin learn ?

    AND

    (2) when BEEP OK, that number show. How to doing next click cmd1_click event?

    any idea please!
    Last edited by rpool; May 19th, 2010 at 06:08 AM.

  2. #2
    Junior Member
    Join Date
    May 2010
    Posts
    19

    Re: barcode text event

    这些数字有没有规律?如果有规律就好办了。

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: barcode text event

    Try this:
    Code:
    Private Sub Text1_Change()
        Text1.Text = Format(Text1.Text, "#-######-######")
    End Sub
    I don't understand the second question.
    ...

    Edit:

    @winnip: Please try to post it in English. Translation of his comment: "These figures are not the law? If the law easier to handle."

    請用英語 = Please use english language
    Last edited by akhileshbc; May 19th, 2010 at 03:45 AM.

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2009
    Posts
    492

    Re: barcode text event

    I think I need that, but if BARCODE that BEEP, all number show to Text1.Text, where to automatic click _command1 event ?
    Last edited by rpool; May 19th, 2010 at 04:18 AM.

  5. #5
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: barcode text event

    Can you show us the code that deals with barcode ?

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2009
    Posts
    492

    Re: barcode text event

    here, I write this code, but BUG.

    Code:
    Private Sub Command1_Click()
    List1.AddItem ean_format(Text1.Text)
    Text1.Text = ""
    
    End Sub
    
    Public Function ean_format(ByVal a As String) As String
     
     Select Case Len(a)
     Case Is = 13
      ean_format = Format(a, "#-######-######")
     Case Is = 12
      ean_format = Format(a, "#-#####-#####-#")
     Case Else
     ean_format = a
     End Select
     
     
    End Function
    
    Private Sub Text1_Change()
    Command1_Click
    
    End Sub
    Attached Images Attached Images  

  7. #7
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: barcode text event

    Can you show us the BARCODE reader control's code ? The code that you use for getting the Barcode from the bracode reader.

    Change event will be fired each time when a change is made in the textbox.
    Example: you want to type 123456 in textbox.
    When you type 1, Change event will be executed. And you continue typing the second number ie. 2. Again the change event will be fired. Like that.
    That's why, your code is not working.

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2009
    Posts
    492

    Re: barcode text event

    here, I update it. is work fine, but only in Text1_Change check Len(13)
    if code not len(13) , not sucesss.

    because if Text1_Change len(12), change event will be executed.

    where can good control it?


    Code:
    Private Sub Command1_Click()
    List1.AddItem ean_format(Text1.Text)
    Text1.Text = ""
    Text1.TabIndex = 1
    
    
    End Sub
    
    Public Function ean_format(ByVal a As String) As String
     
     Select Case Len(a)
     Case Is = 13
      ean_format = (Mid(a, 1, 1) & "=" & Mid(a, 2, 6) & "-" & Mid(a, 8, 6))
     Case Is = 12
      ean_format = (Mid(a, 1, 1) & "=" & Mid(a, 2, 5) & "-" & Mid(a, 7, 5) & "-" & Mid(a, 12, 1))
     Case Else
     ean_format = a
     End Select
     
     
    End Function
    
    Private Sub Text1_Change()
    
    
    Select Case Len(Text1.Text)
    Case Is = 13
    Command1_Click
    
    Case Is = 12
    Command1_Click
    
    
    End Select
    
    
    End Sub
    EDIT1:

    >Can you show us the BARCODE reader control's code ?
    >The code that you use for getting the Barcode from the bracode reader.

    I'm not sure, what is control code, I can't find.
    I known can cap. all digi only. no auto insert +ENTER.
    Last edited by rpool; May 19th, 2010 at 05:24 AM.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2009
    Posts
    492

    Re: barcode text_change() event

    here, I known if used Text1_Change(), is not good choice,
    I think KeyPress, when sucess BEEP, used keyboard +enter key, maybe good way to handle...

    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then     '~~~> 13 is for Enter key
    	  If Len(Text1.Text) > 2 Then
    	    Command1_Click
    	    End If
        
      End If
    End Sub

  10. #10
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: barcode text_change() event

    From where do you get the barcode, to display it in your textbox. I mean, from where this textbox is updated with the barcode values ?

    Are you simply typing the barcode data in your textbox ?

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

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