Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

how to display barcode scanner values in another page?

$
0
0

here im using display alert. But instead of display alert i want to show my value in another page.

public HomePage()
{
Button scanBtn = new Button
{
Text = "Scan Barcode",
HorizontalOptions = LayoutOptions.FillAndExpand,
};

        scanBtn.Clicked += async (sender, args) =>
        {
            var scanResult = await Acr.BarCodes.BarCodes.Instance.Read();
            if (!scanResult.Success)
            {
                await Navigation.PushAsync(new Page1());
               // await this.DisplayAlert("Alert ! ", "Sorry ! \n Failed to read the Barcode !", "OK");
            }
            else
            {
                await this.DisplayAlert("Scan Successful !", String.Format("Barcode Format : {0} \n Barcode Value : {1}", scanResult.Format, scanResult.Code), "OK");

                string id = scanResult.Code;
            }
        };

        Content = new StackLayout
        {
            Children = {
                scanBtn
            }
        };
    }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>