textbox value-VBForums
Results 1 to 3 of 3

Thread: textbox value

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    textbox value

    In my wpf application, there is a listbox a several textboxes.
    On clicking an item in the listbox, the textboxes are populated accordingly.
    Do you know why the following happens?
    select an item in the listbox.
    textboxes are populated with other fields for the selected item. Let's say textbox1 has an empty value.
    Type "hello" in the textbox.
    select another item from the listbox.
    Now in the listbox, select the original item you selected. the textbox has the value "hello".
    If application is closed and re-opened then obviously the word "hello" is not there.
    Do you see why the value is retained eventhough the data is not saved into the database?
    Thanks

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,586

    Re: textbox value

    Maybe because there is no update statement/command?
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  3. #3
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,422

    Re: textbox value

    Because a TextBox binding defaults to TwoWay, meaning any changes you make in the TextBox get pushed back to the bound property. You have two choices if you don't want that behaviour. Firstly, specify a Mode of OneWay on the Binding. Secondly, use a TextBlock or Label which default to OneWay and don't have editing capabilities (it would seem odd to have an editable TextBox that doesn't save any changes you make)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.