سلام دوستان من یه برنامه نوشتم یه ماشین حساب اولین برنامم هست حالا یه ارور میگیره کدش این شکلی نوشتم
public class MainActivity : Activity { EditText editText1; EditText editText2; Button button1; TextView textview1; int a,b,c=1; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it button1 = FindViewById<Button>(Resource.Id.button1); textview1 = FindViewById<TextView>(Resource.Id.textView1); editText1 = FindViewById<EditText>(Resource.Id.editText1); editText2 = FindViewById<EditText>(Resource.Id.editText2); button1.Click += Button1_Click; } private void Button1_Click(object sender, EventArgs e) { a=Convert.ToInt32(editText1); b=Convert.ToInt32(editText1); c = a + b; textview1.Text=Convert.ToString(c); }
ممنون میشم ببینید مشکل چیه راستی ارور رو از متغییر های a,b میگیره راستی کد نویسیش درسته؟
private void Button1_Click(object sender, EventArgs e) { a=Convert.ToInt32(editText1.Text); b=Convert.ToInt32(editText1.Text); c = a + b; textview1.Text=Convert.ToString(c); }
سلام من هم یک سوال داشتم
System.NullReferenceException: Object reference not set to an instance of an object
دلیل این ارور چیه؟
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)