为什么会显示不出来

evonne0102 2006-10-25 10:18:43
手写datagridview代码!
public void CurrencyManagerForm_Load(object sender, System.EventArgs e)
{
if (this.datc.fnGetDataConnection())
{
this.dataGridView1.ReadOnly = true;
this.dataGridView1.DataSource = datc.dSet.Tables["PersonalTable"];
this.dataGridView1.DataMember = "PersonalTable";
fnGetDataBindingForTextBoxes();
//set CurrencyManager for the "PersonTable" table
fnSetCurrencyManager();
//display record numbers in the StatusBar
//fnDisplayRecordNumbers();
} else {
MessageBox.Show("Connection failed...");
Application.Exit(); //end the program
}

}

private void fnGetDataBindingForTextBoxes()
{
//DataBindings for all TextBoxes on the Form
this.textboxFirstname.DataBindings.Add("Text", datc.dSet.Tables["PersonalTable"],"FirstName");
this.textboxLastname.DataBindings.Add("Text", datc.dSet.Tables["PersonalTable"],"LastName");
this.textboxTitle.DataBindings.Add("Text", datc.dSet.Tables["PersonalTable"],"Title");
this.textboxCity.DataBindings.Add("Text", datc.dSet.Tables["PersonalTable"],"City");
this.textboxCountry.DataBindings.Add("Text", datc.dSet.Tables["PersonalTable"],"Country");
}

public void fnSetCurrencyManager()
{
//Initialize CurrencyManager for the table "PersonTable"
currManager=(CurrencyManager)this.BindingContext[datc.dSet.Tables["PersonalTable"]];

}
为什么运行后控件不显示任何数据!!
求大哥来帮忙 自己晕了!!失落!!
...全文
87 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Knight94 2006-10-26
  • 打赏
  • 举报
回复
把如下这句删除
this.dataGridView1.DataMember = "PersonalTable";

111,093

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧