小编Dav*_*vid的帖子

DataGridView 单元格在 CellLeave 上为空

当单元格离开时,我试图对单元格的内容进行一些文本处理。我有以下代码,但是当我在单元格中输入任何文本然后离开时出现以下异常。

An unhandled exception of type 'System.NullReferenceException' occurred in Program.exe

Additional information: Object reference not set to an instance of an object.
Run Code Online (Sandbox Code Playgroud)

如果我打破并将鼠标悬停在上面.value它确实为空,但我已将数据输入到单元格中!那么什么给呢?

private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
    if (e.ColumnIndex == 3)
    {
        string entry = "";
        MessageBox.Show(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
        MakeTextFeet(entry);
    }
    if (e.ColumnIndex == 4)
    {
        string entry = dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString();
        MakeTextFeet(entry);
    }
}
Run Code Online (Sandbox Code Playgroud)

c# datagridview visual-studio-2012

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

VSTO c#检查单元格是否为空

所以我开始使用VSTO,我希望这个问题已经被问到并回答了,但是,我找不到这样的答案.

所以,如果我有一个单元格的引用,我该如何检查它是否为空.

伪代码:

Excel.Range cell = (Excel.Range)MyRange.Cells[1, 1];
if (cell.value2.IsNull) { Stuff }
else { Other Stuff }
Run Code Online (Sandbox Code Playgroud)

不幸的是,IsNull不存在.

c# excel vsto

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

Mercurial不知道是否有回购

我在Mercurial的第一天,我做了我的谷歌作业,但我找不到解决方案.

这是服务器的输出,它应该比我更好地解释事情:

david@triton:~/www/triton$ ls -l -a | grep .hg
drwxr-xr-x  4 david david 4096 2011-11-19 17:44 .hg
-rw-r--r--  1 david david    0 2011-11-18 22:23 .hgignore
david@triton:~/www/triton$ hg init
abort: repository . already exists!
david@triton:~/www/triton$ hg serve
abort: There is no Mercurial repository here (.hg not found)!
Run Code Online (Sandbox Code Playgroud)

我试图从Windows客户端上的tortiseHG推送到这台服务器,但它也抱怨没有回购.

什么鬼,伙计们?

mercurial tortoisehg

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