actual record

  • Thread starter Thread starter Jose
  • Start date Start date
J

Jose

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)
 
Jose,

Please don't start new threads about the same question.

This is not a 10 second answer newsgroup.

Thanks in advance.

Cor
 
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
 
Back
Top