N
Nathan Carroll
I have a user control that functions like a combo box. The problem I have
with it is when I go to getChanges from the datatable it always reports rows
as being changed. I bind to this SelectedValue by
me.DataBindings.Add(New Binding("SelectedValue", dataset,
"tablename.fieldname")) . What is causing the datarow to have changes? I
know that the proximately it comes from the usercontrol and that it comes
from the binding of selectedvalue. But am not understanding where beyond
that.
Dim sv As Object
<Bindable(True)> _
Public Property SelectedValue() As Object
Get
Return sv
End Get
Set(ByVal Value As Object)
sv = Value
If Not Me.DataViewer Is Nothing Then
If Me.DataViewer.Count > 0 And Not Me.fromkeypress And Not
Me.activateleave Then
Me.DataViewer.Sort = Me.ValueMember
Dim index As Integer = Me.DataViewer.Find(Value)
If index > -1 Then
Me.txBOX.Text =
Convert.ToString(Me.DataSource.Rows(index).Item(Me.DisplayMember))
Else
Me.txBOX.Text = Convert.ToString(Value)
End If
ElseIf Not Me.activateleave Then
Me.txBOX.Text = ""
End If
End If
End Set
End Property
with it is when I go to getChanges from the datatable it always reports rows
as being changed. I bind to this SelectedValue by
me.DataBindings.Add(New Binding("SelectedValue", dataset,
"tablename.fieldname")) . What is causing the datarow to have changes? I
know that the proximately it comes from the usercontrol and that it comes
from the binding of selectedvalue. But am not understanding where beyond
that.
Dim sv As Object
<Bindable(True)> _
Public Property SelectedValue() As Object
Get
Return sv
End Get
Set(ByVal Value As Object)
sv = Value
If Not Me.DataViewer Is Nothing Then
If Me.DataViewer.Count > 0 And Not Me.fromkeypress And Not
Me.activateleave Then
Me.DataViewer.Sort = Me.ValueMember
Dim index As Integer = Me.DataViewer.Find(Value)
If index > -1 Then
Me.txBOX.Text =
Convert.ToString(Me.DataSource.Rows(index).Item(Me.DisplayMember))
Else
Me.txBOX.Text = Convert.ToString(Value)
End If
ElseIf Not Me.activateleave Then
Me.txBOX.Text = ""
End If
End If
End Set
End Property