[program-l] need help with this code

  • From: Jaffar Sidek <jaffar.sidek10@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Fri, 9 Nov 2018 12:23:01 +0800

Hi.  I am beginning my xamrin application and have run into a problem.

Here is the code:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace HelloXamarin
{
    [Activity(Label = "HelloXamarin", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            Button button = FindViewById<Button>(Resource.Id.MyButton);
            button.Click += delegate { button.Text = "Hello world I am your first App"; };
        }
    }


The error I am getting is as follows:

1>C:\Users\jaffar\source\repos\HelloWorld\HelloWorld\MainActivity.cs(17,28,17,36): error CS0103: The name 'Resource' does not exist in the current context
1>C:\Users\jaffar\source\repos\HelloWorld\HelloWorld\MainActivity.cs(18,50,18,58): error CS0103: The name 'Resource' does not exist in the current context.


I can understand the error so how do i validate the resource context on lines 17 and 18, since all my resource files are contained in the resources folder.


Any help will be greatly appreciated.  Thanks and cheers!

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts:

  • » [program-l] need help with this code - Jaffar Sidek