在VB winforms中创建两个表单之间的主细节(visual basic) [英] Create a master detail between 2 forms in VB winforms (visual basic)

查看:58
本文介绍了在VB winforms中创建两个表单之间的主细节(visual basic)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,因为我是一个相对较新的程序员,我遇到了一个问题,我需要你的帮助。我有两种形式。表单1称为Projectnameform,包含gridview中的地址数据。 Form2被称为ProjectDetailsForm,其中我显示了projectDetails。



所有数据都存储在外部的MS Sql数据库中。我在两个表单上使用Tableadapter,Dataset和Bindingsource来填充数据。



你能告诉我如何在Projectname上选择一行( form1)和buttonClick事件它只显示我在两个表单中创建的projectnameid在form1中所选行的相关详细信息。



你的帮助很大非常赞赏,因为我现在已经开始了5天了。



问候

Marc



我尝试过:



我试图选择form1中的行并将其传递给不可见的标签然后读取labeltext以标识form1的选定行。我试图绑定bindingsource并传递值。

解决方案

OriginalGriff在CodeProject上有一系列提示,可以帮助你在表单之间传递信息。 br />


这是第一个 - 在两种表格之间传递信息,第1部分:父母对儿童 [ ^ ] - 其他人的链接在那篇文章中。


除了CHill60的解决方案1,我还是喜欢提供另一篇有趣的文章:在表单之间传递数据 - VB.NET教程Dream.In.Code [ ^ ]

Hello there, As i am a relative new programmer i encouter a problem that i need your help fore. I have two forms. Form 1 is called "Projectnameform" and contains address data in a gridview. Form2 is called "ProjectDetailsForm" where i have shown projectDetails.

All the data is stored in a MS Sql database externaly. I use a Tableadapter, Dataset and Bindingsource on both forms to fill them with data.

Can you please show me how i can select a row on the "Projectname" (form1) and by a buttonClick event it only shows the related details of the selected row in form1 by the projectnameid that i have created in both forms.

Your help is very much appreciated as im struggeling with this for the pas 5 day's now.

Regards
Marc

What I have tried:

I tried to select the row in form1 and to pass it to an unvisible label and then read the labeltext to identify the selected row of form1. I tried to bind the bindingsource and pass the value.

解决方案

There is a series of tips here on CodeProject by OriginalGriff that should help you pass the information between forms.

Here's the first one - Transferring information between two forms, Part 1: Parent to Child[^] - links to the others are in that article.


In addition to solution 1 by CHill60, i'd like to provide another interesting article: Passing Data Between Forms - VB.NET Tutorials | Dream.In.Code[^]


这篇关于在VB winforms中创建两个表单之间的主细节(visual basic)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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