Jose,
We are changing thanks for telling this to us.
Here the tip as it is there.
\\\\
Controls Databinding (Textbox), given is here a kind of standard routine for
a textbox and a datatable datetime column, the sample needs only a form with
a textbox and two buttons dragged on it (The sample is based on VB2005
style. For VB2002/2003 you have remove the Import, the Public Class Form1
and the End Class and paste it than in)
--------------------------------------------------------------------------------
Imports System.data
Public Class Form1
Dim ds As New DataSet
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
ds.Tables.Add(dt)
dt.Columns.Add("DateField", GetType(System.DateTime))
Dim Mybinding As New Binding("Text", ds.Tables(0), "DateField")
TextBox1.DataBindings.Add(Mybinding)
AddHandler Mybinding.Format, AddressOf DBdateTextbox
AddHandler Mybinding.Parse, AddressOf TextBoxDBdate
dt.LoadDataRow(New Object() {New DateTime(2005, 8, 4)}, True)
dt.LoadDataRow(New Object() {Nothing}, True)
dt.LoadDataRow(New Object() {New DateTime(2005, 8, 5)}, True)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
'forward
If BindingContext(ds.Tables(0)).Position _
< ds.Tables(0).Rows.Count Then
BindingContext(ds.Tables(0)).Position += 1
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
'backward
If BindingContext(ds.Tables(0)).Position > 0 Then
BindingContext(ds.Tables(0)).Position -= 1
End If
End Sub
Private Sub DBdateTextbox(ByVal sender As Object, _
ByVal cevent As ConvertEventArgs)
If cevent.Value Is DBNull.Value Then
cevent.Value = ""
Else
Dim datum As Date
datum = CDate(cevent.Value)
cevent.Value = datum.ToString("d")
End If
End Sub
Private Sub TextBoxDBdate(ByVal sender As Object, _
ByVal cevent As ConvertEventArgs)
If cevent.Value.ToString = "" Then
cevent.Value = DBNull.Value
Else
Dim datum As Date
datum = CDate(cevent.Value)
cevent.Value = datum
End If
End Sub
End Class
I hope this helps,
cor
"Jose" <jo********@unica.com> schreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
Cor this link has problems? I don´t access.
"Cor Ligthert [MVP]" <no************@planet.nl> escribió en el mensaje
news:eo**************@TK2MSFTNGP04.phx.gbl... Jose,
Have a look at this sample where your problem is done.
There is as well your next problem in it.
http://www.vb-tips.com/default.aspx?...9-4deb7fa4a0b8
I hope this helps,
Cor
"Jose" <jo********@unica.com> schreef in bericht
news:e2**************@TK2MSFTNGP04.phx.gbl... How obtain the current record ? this is my code:
Dim fila As DataRow
Dim llaveprimaria(0) As DataColumn
llaveprimaria(0) = dasedo.Tables("tabest").Columns("codigo")
dasedo.Tables("tabest").PrimaryKey() = llaveprimaria
fila = dasedo.Tables("tabest").Rows.Find(c_idfind)
Me.BindingContext(dasedo, "tabest").Position = 1 (bad code line help me
please)