我的代码中有什么错误? [英] What is an error in my code?

查看:103
本文介绍了我的代码中有什么错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

这段代码有什么错误?



Hello,
What is an error in this code?

if (cmbOctroi.Text == "Yes")
{
   for (int i = 0; i < dataGridView1.Rows.Count; i++)
   {
      if (dataGridView1.Rows[i].Cells["OctroiCode"].Value != null)
      {
         MessageBox.Show("Please select octroi Code");
         dataGridView1.Rows[i].Cells["OctroiCode"].Selected = true;
         return;
      }
   }
}
ExportPdf();





这里运行的代码按钮点击事件。

我的ExporttPdf()没有运行。



谢谢



Ankit Agarwal

软件工程师



Here code running on button click event.
My ExporttPdf() is not running.

Thanks

Ankit Agarwal
Software Engineer

推荐答案

修改为休闲

Modify as fallows
if (dataGridView1.Rows[i].Cells["OctroiCode"].Value == null)//(dataGridView1.Rows[i].Cells["OctroiCode"].Value != null)
                       {
                           MessageBox.Show("Please select octroi Code");
                           dataGridView1.Rows[i].Cells["OctroiCode"].Selected = true;
                           return;
                       }





主要问题是函数执行结束的返回行。



The main problem is return line where your function execution get ended.


这篇关于我的代码中有什么错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆