Public Class Form1
Public Class Form1 Private CurrMgr As CurrencyManager Private DtVw As DataView Private tbl As New DataTable("tbl1")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load tbl.Columns.Add("Col1", System.Type.GetType("System.String")) DtVw = New DataView(tbl) DtVw.Sort = "Col1"
Dim row As DataRow = tbl.NewRow row(0) = "A" tbl.Rows.Add(row) row =
tbl.NewRow row(0) = "Z"
tbl.Rows.Add(row) CurrMgr = CType(Me.BindingContext(DtVw), CurrencyManager)
Dim b As Binding = New
Binding("Text",
DtVw, "Col1")
TextBox1.DataBindings.Add(b) End
Sub
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
CurrMgr.AddNew() End Sub
Private
Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button2.Click
CurrMgr.EndCurrentEdit() End Sub
End Class
|