Go to the barcode field's Properties and under the Value tab you can enter a custom calculation script that will do that.
Hello Sir ,
But IS it working on button click event ?
If you set it up like that, then yes, it would work when a button is clicked.
How to set up It ?