C#绑定在表中的特定行 [英] c# Binding on specific row in table

查看:112
本文介绍了C#绑定在表中的特定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用C#.NET 2.0,我想一个文本框绑定到我的表的特定行。在示例:

Using c# .net 2.0 , I want to bind a textbox to a specific row of my table. In Example :

 Table Person
 ID NAME PRENOM SPECIAL_CATEGORY
  1 BOB  BOB    mex
  2 AL   AL     tot
  3 PO   PO     pap

我想结合我的文本框的字段名所在的行包含special_categeory ='TOT'。 可能吗?或者我需要建立一个数据行此行的和有约束力的。

I want to bind my textbox on the field name where the row contains special_categeory = 'tot'. Is it possible? or I need to create a Datarow for this row and binding it.

推荐答案

您应该能够通过绑定...

You should be able to bind via...

myNameTextBox.DataBindings.Add( "Text", MyTable, "NAME" );
myPrenomTextBox.DataBindings.Add( "Text", MyTable, "PRENOM" );
mySpecial_CategoryTextBox.DataBindings.Add( "Text", MyTable, "SPECIAL_CATEGORY" );

其实,我只是一个框架,通过滚动的所有控件,如果他们在一个给定的表匹配的列名,他们立即约束自己像上面。

I actually have a framework that scrolls through all controls, and if they match a column name in a given table, they immediately bind themselves like above.

然后,当你滚动网格,它应该也刷新了个人文本控件在表单中了。

Then, when you scroll the grid, it should also refresh the individual text controls in your form too.

这篇关于C#绑定在表中的特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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