Event on record change

  • Thread starter Thread starter Hemang Shah
  • Start date Start date
H

Hemang Shah

I have some controls on my form which are bound to a dataset and some which
are not bound.

But whatever record is displayed on the form, I want to populate those
control (datetime, combo, etc.) with the data in the current record.

What event can I do this in ?

PositionChanged of bindingContext - is this called before the record is
current or after ?

if it is after, I can use this.

Please advise.

HS
 
Hemang,

For the dateTime and Combo is probably the problem that you have to bind
those to the value.

Probably is that easier than doing it by hand.

I hope this helps?

Cor
 
Thanks Cor

But the reason I cannot bind to the dataset is because of the control's
limitation to handle DBNull values and also that multiple comboboxes with
the same datasource act in sync with one another which is unexpected.

:)
 
News,

Your first question when it is for the datetimepicker (not tested with a
datetimepicker however I don't know why it would not

\\\
Private Sub myroutine()
Mybinding = New Binding("Value", ds.Tables(0), "mydatfield")
textdatfield.DataBindings.Add(Mybinding)
AddHandler mybinding.Format, AddressOf DBdateTextbox
AddHandler mybinding.Parse, AddressOf TextBoxDBdate
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
End If
End Sub
///

For the secondone you have to create for every control a different dataview
When you don't know how tell than what is your datasource at the moment.

I hope this helps?

Cor
 
Back
Top