小编use*_*879的帖子

C#WPF-切换某物的可见性不起作用

像button.IsVisible = false一样不起作用...它给出了错误:

属性或索引器'System.Windows.UIElement.IsVisible'不能分配给它-只读

我正在制作WPF应用程序...

c# wpf

1
推荐指数
1
解决办法
1291
查看次数

C# - 使用未分配的局部变量'stringnamehere'

这是我的代码:

        private void startButton_Click(object sender, EventArgs e)
    {
        DriveInfo[] drives = DriveInfo.GetDrives();
        string drivenames;
        for (int i = 0; i < drives.Count(); i++)
        drivenames = drives[i].Name;
        MessageBox.Show(drivenames); // --> For debug purposes only
        strCmdText = "del /f /s " + drivenames + "*.sfk";
        System.Diagnostics.Process.Start("CMD.exe", strCmdText);
    }
Run Code Online (Sandbox Code Playgroud)

我试图将计算机上的驱动器号写入字符串,但是,当我尝试使用该字符串时,它表示使用未分配的局部变量'drivenames'.这有什么问题?

c#

0
推荐指数
2
解决办法
212
查看次数

标签 统计

c# ×2

wpf ×1