数据未添加到数据网格视图中:( [英] Data isn't added into data grid view :(

查看:61
本文介绍了数据未添加到数据网格视图中:(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿!



所以我设置了各种变量,然后使用以下代码发送到'MethodLight':



Hey!

So I have various variables set, that are then sent to form 'MethodLight' with this code:

MethodLight MethodLight = new MethodLight();
            MethodLight.AddGridViewRows(Quantity, Interleave, FixtureID, ChannelID, Manufacture, Fixture, Mode, Channels, Weight, Watts, Amps, PowerInput, PowerOutput, Lamp, DataConnection, FixturePos





以'MethodLight'形式我有这个代码:





And in form 'MethodLight' I had this code:

public void AddGridViewRows(int Quantity, int Interleave, int FixtureID, int ChannelID, string Manufacture, string Fixture, string Mode, string Channels, string Weight, string Watts, string Amps, string PowerInput, string PowerOutput, string Lamp, string DataConnection, string Position)
        {
            AddFixtures AddFixtures = new AddFixtures();
            FixtureDataView.Rows.Add(FixtureID, ChannelID, Manufacture, Fixture, Mode, Channels, Weight, Watts, Amps, PowerInput, PowerOutput, Lamp, DataConnection, Position);
        }





但是当我点击发送数据到



But when I click on the button that sends the data to

AddGridViewRows

,什么都没发生ns根本没有数据添加到datagridview。



有什么想法吗?



干杯



我尝试了什么:



我尝试了不同的方法来添加数据,比如通过数组,但似乎没有任何工作

, nothing happens at all, no data is added to the datagridview.

Any ideas?

Cheers

What I have tried:

I have tried different ways to add the data, like through an array, but nothing seems to work

推荐答案

简单:它是表单的 new 实例,代码非常具体。这意味着数据将添加到新实例中的DGV而不是任何现有实例。由于您的代码不会在新实例上调用Show或ShowDialog,因此没有人可以看到新数据。



您需要将其添加到现有实例中用户正在看...
Simple: it's a new instance of the form, the code is very specific about that. Which means that the data is added to the DGV in the new instance not any existing instance. And since your code doesn't call Show or ShowDialog on the new instance, nobody gets to see the new data.

You need to add it to the existing instance that the user is looking at ...


这篇关于数据未添加到数据网格视图中:(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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