datatable defaultvalue changed programmatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nev
    Contributor
    • Oct 2007
    • 251

    datatable defaultvalue changed programmatically

    my datatable column defaultvalue depends on what is displayed on a textbox. but i noticed that you can only set the defaultvalue once because when i set it again, the defaultvalue remains the same as what i set as a defaultvalue in the beginning.

    how will i get this to work? i want the defaultvalue of my datatable to change to what is placed in my textbox.
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    you have to issue the Update command if you want to save any changes!

    Is this a windows form or asp .net application?

    Comment

    • nev
      Contributor
      • Oct 2007
      • 251

      #3
      Originally posted by Shashi Sadasivan
      you have to issue the Update command if you want to save any changes!

      Is this a windows form or asp .net application?
      thank you for your reply. i'll try it at once! its a windows form :-)

      Comment

      • nev
        Contributor
        • Oct 2007
        • 251

        #4
        it doesn't work

        the defaultvalue still remains unchanged

        dtt.column.defa ultvalue = "hello" 'this is ok

        when i add new in the datagridview, the column automatically displays "hello" as the default value.

        then i do another dtt.column.defa ultvalue = "world" 'this is not ok

        when i add new in the datagridview, the column still automatically displays "hello" as the default value and not "world".

        how do?

        Comment

        • Shashi Sadasivan
          Recognized Expert Top Contributor
          • Aug 2007
          • 1435

          #5
          are you setting the default values programatically or in the design mode (ie in the dataset file)

          if you are doing programatically please make sure that you remove all instances where you set the default value to "hello"

          Comment

          • nev
            Contributor
            • Oct 2007
            • 251

            #6
            ohhhh, hohoho! it works! i just forgot to assign the second value in my code :-) hohoho! merry christmas!

            Comment

            Working...