Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Auto Notes Help!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Resolved [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"

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    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"

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    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
  •  



Click Here to Expand Forum to Full Width