以第二种形式输入数据并一次以datagridview形式显示数据如何? [英] Enter data in second form and at a time show a data in datagridview form how ?

查看:55
本文介绍了以第二种形式输入数据并一次以datagridview形式显示数据如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表格

1表格是在datagridview中显示表格数据

2表格是输入数据



问题是数据输入成功但是一次保存数据并以datagridview形式显示是不是这样的



我有什么试过:



i试图一次显示一个数据表连接表

解决方案

具体如何执行此操作取决于表单之间的关系。如果Form1为Form2创建一个实例,则Form1是父,而Form2是子:

在两种形式之间传递信息,第1部分:父母对儿童 [ ^ ]

在两种形式之间传递信息,第2部分:儿童到父母 [ ^ ]

在两种表格之间传递信息,第3部分:儿童与儿童 [ ^ ]

其中一个应该覆盖它,并进行一些小的调整。

它减少了形式协作的流行(我不知道为什么)的问题。请参阅我关于此主题的文章:一次回答的许多问题 - 之间的协作Windows窗体或WPF Windows



注意:关于解决方案1:没有父和子形式。父子关系,正式为从 System.Windows.Forms.Control 派生的所有类定义,但对表单实际上已不存在。有一个主要形式和其他形式,以及所有权关系,非常有用。在实践中,最好使主表单拥有所有表单。



此外,通常最好的UI设计仅基于一种形式(不包括有限的数​​量)模态形式)。你制作一个单独的表单可以做一些父控件,如面板,标签页等。



-SA

i have Two forms
1 forms is show a table data in datagridview
2 form is enter a data

problem is data enter successfully but at a time save a data and display in datagridview form is can't how it this

What I have tried:

i tried to dispaly a data at a time form connection a table

解决方案

Exactly how you do this depends on the "Relationship" between the forms. If Form1 creates an instance for Form2, then Form1 is the "parent", and Form2 is the "child":
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
One of them should cover it, with a few minor tweaks.


It reduces to a popular (I don't know why) question of form collaboration. Please see my article on the topic: Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows.

Note: about Solution 1: there is no such thing as "parent" and "child" form. The parent-child relationship, formally defined for all the classes derived from System.Windows.Forms.Control, but made virtually defunct for forms. There is a main form and other forms, and also ownership relationship, very useful. In practice, it's good to make all forms owned by the main form.

Besides, usually the best UI design is based on only one form (not counting limited number of modal forms). What you make a separate form can be made some parent control, such as panel, tab page, etc.

—SA


这篇关于以第二种形式输入数据并一次以datagridview形式显示数据如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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