作者vbip (大森)
看板Visual_Basic
标题[.NET] databinding後...清除资料无效
时间Wed Jul 20 00:21:08 2005
form.vb[设计]
TabControl1有{TabPage1、TabPage1}两各页签
在{TabPage1}页签内有TextBox1
在{TabPage2}页签内有TextBox2
Button1
---------------------------
form.vb
form1_load()
Dim cn As SqlConnection = New SqlConnection("user id=sa.......................)
Dim da As SqlDataAdapter = New SqlDataAdapter
("select * from packettable", cn)
Dim ds As DataSet = New DataSet
Dim dt As DataTable = New DataTable
cn.Open()
da.Fill(ds, "dt")
TextBox1.DataBindings.Add("text", ds, "dt.packet_name")
TextBox2.DataBindings.Add("text", ds, "dt.receive_date")
cn.Close()
-------------------------------
Button1_Click
TextBox1.Clear()
TextBox2.Clear()
------------------------------
为什麽系结後我按button1再切换TabPage2页签,TextBox2的资料还在~
在debug内textbox1 and textbox2 都是""了
请问要如何解决呢~~谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.59.172.78