|
-
Aug 28th, 2007, 03:38 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] Auto Notes Help!
Code:
Private Function Auto_Notes() As String
'Employer auto notes
Dim drER As DataRow
drER = Me.DsEmployer1.Tables("Employer").Rows(0)
Dim i As Integer
For i = 0 To drER.Table.Columns.Count - 1
If drER(i, DataRowVersion.Original).ToString <> drER(i, DataRowVersion.Default).ToString Then
Auto_Notes += drER.Table.Columns(i).ColumnName & " changed from '" & drER(i, DataRowVersion.Original) & "' to '" & drER(i, DataRowVersion.Default) & "'. "
End If
I did not write this code the guy before me did, but i know what he was trying to do and it half works. A bound combobox gives you difference options. if you change what's in the combobox and hit Save and runs this Auto Notes and looks at what was in the table Originally and then What its going to be.
But my output string looks like this:
"Business_Structure changed from 'C-Corp' to ''. "
It's giving me the original value but not what the new one is. Is this code wrong? or something else? It seems to work when it's used on a different table.
Any help would be appreciated. Thanks!
Tuber
"I don't know the rules"
-
Aug 28th, 2007, 04:17 PM
#2
Re: [2005] Auto Notes Help!
my guess would be it has something to do with using DataRowVersion.Default
I would think you would want to use something like DataRowVersion.Proposed (of the update has not yet happened) or DataRowVersion.Current (if the update already has happened)
-
Aug 28th, 2007, 04:37 PM
#3
Thread Starter
Hyperactive Member
Re: [2005] Auto Notes Help!
I tried the Proposed and the same thing is happening. There is another comboBox bound to the same exact table and the notes works for it. It runs through the same exact code. So I was thinking it's not the code. I started looking at the 2 ComboBox's properties and I notice the one that doesn't work is set to a dropdown list and it has different bindings. The SelectedItem is set to the binding source as well as the SelectedValue. the ComboBox that works is not bound in this fashion. When I copied all the properties it still didn't work. So now I'm completely lost.
EDIT: Oh yeah Thanks for the help Kleinma
Tuber
"I don't know the rules"
-
Aug 28th, 2007, 04:48 PM
#4
Thread Starter
Hyperactive Member
Re: [2005] Auto Notes Help!
WOW.....so stupid. that was just it. The SelectedItem and SelectedValue were set to a binding source but the Text Binding was bound to the dataset. After switching this all is well.
Tuber
"I don't know the rules"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|