Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.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# 我可以根据';她在另一个班吗?_C#_Class_Combobox_Datetimepicker - Fatal编程技术网

C# 我可以根据';她在另一个班吗?

C# 我可以根据';她在另一个班吗?,c#,class,combobox,datetimepicker,C#,Class,Combobox,Datetimepicker,初学者的问题,但任何帮助将不胜感激 我可以根据另一个类中文本框的值禁用组合框或dtp吗 我有一个日期/时间选择器,如果来自另一个类的文本框中有任何值,我想禁用它 最好的方法是什么 最好的方式是举办这样的活动: private void ReadWriteTB_TextChanged(object sender, RoutedEventArgs e) { if (condition) comboBox.Enabled = false; } 您的对象的范围是什么?你能通过

初学者的问题,但任何帮助将不胜感激

我可以根据另一个类中文本框的值禁用组合框或dtp吗

我有一个日期/时间选择器,如果来自另一个类的文本框中有任何值,我想禁用它


最好的方法是什么

最好的方式是举办这样的活动:

private void ReadWriteTB_TextChanged(object sender, RoutedEventArgs e)
{
    if (condition)
        comboBox.Enabled = false;

}

您的对象的范围是什么?你能通过提供代码示例来澄清吗?对不起!!你能提供额外的细节吗?这正是我想要做的,但是我无法访问txtcount(文本框),它不是在intellisense中出现的,而在包含我想要禁用的combobox的类中。你可以用属性公开它
public TextBox YourTextBox{get{return txtcount;}}}
。这样您就可以执行
YourClass.YourTextBox.Enabled=false