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
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
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
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
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.
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
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