表格自动关闭 [英] Form is close automatically

查看:107
本文介绍了表格自动关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,我在我的c#项目中收到错误,错误是我的表单在表单加载时自动关闭我想在加载代码上加上datagridview单元格值,请检查它并告诉我该怎么做。



我的尝试:



Hello friends,i am getting an error in my c# project and the error is my form is automatically closed on form load i want to sum datagridview cell value on load code is below please check it and tell me how can i do this.

What I have tried:

for (int i = 0; i < dataGridView2.Rows.Count; ++i)
            {

                //    sum1 += Convert.ToInt32(dataGridView2.Rows[i].Cells[1].Value);
                //}
                //textBox14.Text = "";
                String example = dataGridView2.Rows[i].Cells[1].Value.ToString();
                Int32 sum1 = example.Split(new char[] { ',' })   // get the "list" of strings
                                   .Select(n => Int32.Parse(n)) // get the "list" of integers
                                   .Sum();
                textBox14.Text = sum1.ToString();
            }

推荐答案

检查每个 [FormName] .Close()在你的代码中设置一个断点。如果它们不应该被使用,调试器将停止您的代码并向您显示确切的位置。
Check for each [FormName].Close() in your code and set a breakpoint on them. If they are being used when they should not be, the debugger will stop your code and show you exactly where.


这篇关于表格自动关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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