Anyone cen post me the entire correct code forscanning barcode using a button to opens scanner?
THANKS
Anyone cen post me the entire correct code forscanning barcode using a button to opens scanner?
THANKS
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajkiran SwainRank #165 · 14.4K reputationPosted May 25, 2023, 4:37 AM EDT
using ZXing; using ZXing.Common; using ZXing.Mobile; using System; using System.Drawing; using System.Windows.Forms; namespace BarcodeScannerApp { public partial class Form1 : Form { private MobileBarcodeScanner scanner; public Form1() { InitializeComponent(); scanner = new MobileBarcodeScanner(); } private void btnScan_Click(object sender, EventArgs e) { // Configure the scanner options var options = new MobileBarcodeScanningOptions { AutoRotate = false, TryHarder = true, PossibleFormats = new BarcodeFormat[] { BarcodeFormat.All_1D, BarcodeFormat.QR_CODE } }; // Start scanning scanner.Scan(options).ContinueWith(t => { if (t.Result != null && !string.IsNullOrWhiteSpace(t.Result.Text)) { // Barcode was successfully scanned string scannedData = t.Result.Text; MessageBox.Show("Scanned Barcode: " + scannedData); } else { // Scanning was cancelled or failed MessageBox.Show("Scanning was cancelled or failed."); } }, TaskScheduler.FromCurrentSynchronizationContext()); } } }Riccardo Daria84 reputationPosted May 25, 2023, 4:58 AM EDT
i need code for xamarine