Code
Public Class Form1VB.NET
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
'THE TABLE
tbl.Columns.Add("Col1", System.Type.GetType("System.String"))
DtVw = New DataView(tbl)
DtVw.Sort = "Col1"row(0) = "A" tbl.Rows.Add(row)
row = tbl.NewRow
row(0) = "Z" tbl.Rows.Add(row)
'CURRENCY MANAGER
CurrMgr = CType(Me.BindingContext(DtVw), CurrencyManager)
'Bind Control
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
Code
Answers
Know the answer? Post it. Somebody with the same question will find it here.