C# System.NullReferenceException: 'Object reference not set to an instance of an object.'

Sdílet
Vložit
  • čas přidán 8. 09. 2024
  • For French, Swahili, and Lingala Tutoriels Contact us at:
    stallonebininfo@gmail.com
    +265 99 390 6365 On WhatsApp or a normal call

Komentáře • 13

  • @ahmedmuhamed6809
    @ahmedmuhamed6809 Před rokem +2

    good job

  • @lavarajugiduturi2441
    @lavarajugiduturi2441 Před 2 lety +1

    Good explanation brother! Keep more !

  • @egideemtv7609
    @egideemtv7609 Před 2 lety +1

    Thanks

  • @sayanabharati6548
    @sayanabharati6548 Před 11 měsíci

    Can this work for xamarin application in Visual studio 2022?

    • @lumbochengebin
      @lumbochengebin  Před 11 měsíci

      Yes, even for Xamarin form

    • @sayanabharati6548
      @sayanabharati6548 Před 11 měsíci

      In xamarin, I have initialised the variables which are storing the data but still the same error after deployment of the app in the mobile

    • @lumbochengebin
      @lumbochengebin  Před 11 měsíci

      @@sayanabharati6548 Please try to put the breakpoint and run it to see where the error is coming from, or share with me that block of code

    • @sayanabharati6548
      @sayanabharati6548 Před 11 měsíci

      @@lumbochengebin
      public partial class MainPage : ContentPage
      {
      private string gatewayIpAddress = string.Empty;
      private string routerSSID = string.Empty;
      private string routerPassword = string.Empty;
      public MainPage()
      {
      InitializeComponent();
      }
      private async void ScanGatewayQR_Clicked(object sender, EventArgs e)
      {
      try
      {
      var scanner = new MobileBarcodeScanner();
      var result = await scanner.Scan();
      if (result != null && !string.IsNullOrEmpty(result.Text))
      {
      gatewayIpAddress = ExtractIpAddressFromQR(result.Text);
      await DisplayAlert("Gateway QR Scanned", $"Gateway IP Address: {gatewayIpAddress}", "OK");
      }
      else
      {
      await DisplayAlert("Error", "Failed to scan Gateway QR code", "OK");
      }
      }
      catch (Exception ex)
      {
      await DisplayAlert("Error", ex.Message, "OK");
      }
      }
      private async void ScanRouterQR_Clicked(object sender, EventArgs e)
      {
      try
      {
      var scanner = new MobileBarcodeScanner();
      var result = await scanner.Scan();
      if (result != null && !string.IsNullOrEmpty(result.Text))
      {
      (routerSSID, routerPassword) = ExtractSSIDAndPasswordFromQR(result.Text);
      await DisplayAlert("Router QR Scanned", "Scanned successfully!", "OK");
      }
      else
      {
      await DisplayAlert("Error", "Failed to scan Router QR code", "OK");
      }
      }
      catch (Exception ex)
      {
      await DisplayAlert("Error", ex.Message, "OK");
      }
      }

  • @ceroh1435
    @ceroh1435 Před 2 lety +1

    Ty

  • @44D3N
    @44D3N Před rokem

    what would I do if its a panel. "this.panel6.Controls.Add(this.Dev);"

    • @lumbochengebin
      @lumbochengebin  Před rokem

      share with me more details please

    • @44D3N
      @44D3N Před rokem

      @@lumbochengebin this only happens with windows 11 computers and when ever my form starts it gives me an error and shows that