Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用textbox.text作为字符串?_C#_Wpf - Fatal编程技术网

C# 使用textbox.text作为字符串?

C# 使用textbox.text作为字符串?,c#,wpf,C#,Wpf,我的代码有这个问题,给了我错误。 这是我的密码: public void SetConnectionSettings(string ndisplayname, string nserverip, string nserverport) { string sdisplayname = ndisplayname; string sserverip = nserverip; string sserverport = nserverport;

我的代码有这个问题,给了我错误。 这是我的密码:

public void SetConnectionSettings(string ndisplayname, string nserverip, string nserverport)
    {
        string sdisplayname = ndisplayname;
        string sserverip = nserverip;
        string sserverport = nserverport;

    }

private void Button_Click(object sender, RoutedEventArgs e)
    {


         try
            {

                SetConnectionSettings(DisplayName.text, CBsip.text, CBsport.text);
            }
            catch (NullReferenceException nre)
            {
                Console.WriteLine(
                   "Failed\n" +
                   nre.Message);
            }}
它告诉我

它不包含“text”的定义,也不包含扩展方法 “文本”接受第一个参数

有什么想法吗? 提前谢谢

SetConnectionSettings(DisplayName.Text, CBsip.Text, CBsport.Text);
它是区分大小写的,所以在C#中必须使用大写字母T,方法、名称空间、类和公共字段都使用大写字母。 只有局部变量和私有成员使用小写


因此,当您想要访问字段或类的方法时,请记住使用大写字符。

不使用Intellisense或任何其他自动补全功能?