本文介绍了我已经使用了数据表(dt1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行时,我正在将值传递给datagridview
Datagridview(Photo,PlayerName,Age,BattingStyle,BowlingStyle,Country)表名称= dt1中的列.
在Windows窗体中,当我单击 UPDATE 按钮时,它将显示Playername的组合框,而不是文本框.
因此,当我选择播放器剩余的文本框时,我将如何将其名称添加到组合框列表中,从而在播放器的详细信息中填充诸如Photo,Age,BattingStyle,BowlingStyle,Country之类的播放器详细信息.

At runtime i am passing values to datagridview
columns in Datagridview(Photo,PlayerName,Age,BattingStyle,BowlingStyle,Country) table name =dt1.
In windows form when i click UPDATE button it will display combobox for Playername instead of textbox.
So,how can i get the players name into the combobox list,when i select the player remaining textboxes will be fill with player details like Photo,Age,BattingStyle,BowlingStyle,Country.

推荐答案

cmbPlayer.ValueMemberPath="PlayerName";
cmbPlayer.DisplayMemberPath="PlayerName";
cmbPLayer.DataSource=dt1;




并在组合框中选择索引已更改事件,并获取数据表的数据行,并为对应的播放器名称将值绑定到文本框




ANd in combobox selected index changed event , get the datarow of datatable and for coresponding playername bind the values to textbox


这篇关于我已经使用了数据表(dt1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 03:48