简体   繁体   English

C#CS0123:匹配委托Eventhandler没有重载

[英]C# CS0123: No overload for matches delegate Eventhandler

I have the following code for an Android app in C# 我在C#中为Android应用程序提供了以下代码

using Android.App;
using Android.Widget;
using Android.OS;

namespace Practicum1
{
    [Activity(Label = "Practicum 1.2.1", MainLauncher = true)]
    public class MainActivity : Activity
    {
        EditText invullen;
        TextView displaynaam;


        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            TextView begintekst;
            begintekst = new TextView(this);
            begintekst.Text = "Vul je naam in!";

            invullen = new EditText(this);
            invullen.TextChanged += naam_textChanged;

            displaynaam = new TextView(this);
            displaynaam.Text = "Hier kom je naam te staan";


            LinearLayout stapel;
            stapel = new LinearLayout(this);
            stapel.Orientation = Orientation.Vertical;

            stapel.AddView(begintekst);
            stapel.AddView(invullen);
            stapel.AddView(displaynaam);



            // Set our view from the "main" layout resource
            this.SetContentView(stapel);
        }
        private void naam_textChanged(object sender, ItemEventArgs ea)
        {
            displaynaam.Text = "Welkom " + invullen.Text;
        }
    }
}

But then I get the following error message: 'No overload for naam_textChanged matches delegate EventHandler 但后来我收到以下错误消息:'naam_textChanged没有重载匹配委托EventHandler

Does anyone know how to solve this? 有谁知道如何解决这个问题?

Regards, Joren 问候,乔仁

Your event arguments are not correct. 您的事件参数不正确。 It should look like this. 它看起来应该是这样的。

private void naam_TextChanged (object sender, TextChangedEventArgs e)
{

}

Check documentation of EditText 检查EditText的文档

Point 4) Implement the TextChanged event to capture the text from the EditText and write it to the TextView . 要点4)实现TextChanged事件以从EditText捕获文本并将其写入TextView

editText.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {

       textView.Text = e.Text.ToString ();

};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复此错误 - C# CS0123:“方法”没有重载与委托“事件处理程序”匹配 - How can I fix this error - C# CS0123: No overload for “method” matches delegate 'EventHandler' CS0123 C#&#39;HyperlinkBut​​tonClick&#39;的重载与委托&#39;RoutedEventHandler&#39;不匹配 - CS0123 C# No overload for 'HyperlinkButtonClick' matches delegate 'RoutedEventHandler' CS0123 C#&#39;Polar_Checked&#39;没有重载匹配代表&#39;RoutedEventHandler&#39; - CS0123 C# No overload for 'Polar_Checked' matches delegate 'RoutedEventHandler' C#:错误 CS0123:'NewConnectionHandler' 没有重载匹配委托'Action<newconnectioneventargs> '</newconnectioneventargs> - C# : error CS0123: No overload for 'NewConnectionHandler' matches delegate 'Action<NewConnectionEventArgs>' asp.net错误CS0123:没有重载匹配委托&#39;System.EventHandler&#39; - asp.net error CS0123: No overload matches delegate 'System.EventHandler' 我正在尝试对MD5哈希字符串方法进行多线程处理,但收到错误CS0123 C#,匹配委托&#39;ThreadStart&#39;没有重载 - I'm trying to Multi-thread a MD5 Hash string method but getting the error CS0123 C# No overload for matches delegate 'ThreadStart' C#-错误CS0123方法或委托参数与委托参数不匹配 - C# - error CS0123 A method or delegate parameters do not match delegate parameter 引发事件C#给出错误:没有重载匹配委托EventHandler - Raise event c# gives error: No overload matches delegate EventHandler “…”没有重载匹配委托“ EventHandler”吗? - No overload for “…” matches delegate 'EventHandler'? 'SendMsgBtn' 没有重载匹配委托 'EventHandler' - No overload for 'SendMsgBtn' matches delegate 'EventHandler'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM