Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1022529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:28:48+00:00 2026-05-16T11:28:48+00:00

After a hiatus from my Silverlight / F# application, i am starting back into

  • 0

After a hiatus from my Silverlight / F# application, i am starting back into it and am running into an issue I cannot seem to get my head around. I have a member variable of my usercontrol that is a list ref, on button clicks I want to add records to it – but it never updates. I am pretty sure it has to do with being a member but I havent figured it out.

Thanks in advance to those who take the time to view and reply.

the problem lines:

.
.
.
member this.brokers = ref List.empty
.
.
.
// this line doesn't seem to work
this.brokers := candidate :: (!this.brokers)
.
.
.

the class:

type Page() as this =    
    inherit UriUserControl("/xyz;component/page.xaml", "page")
    do
        this.firm.ItemsSource <- RpcXYZ.getFirms()
        this.email.Background <- SolidColorBrush(Colors.Red)
        this.addBtn.IsEnabled <- false
        ()

    // instance data
    member this.brokers = ref List.empty

    // bound controls for add candidate
    member this.FE : FrameworkElement = (this.Content :?> FrameworkElement)
    member this.fname : TextBox = this.FE ? fname
    member this.lname : TextBox = this.FE ? lname
    member this.email : TextBox = this.FE ? email
    member this.firm : RadComboBox = this.FE ? firms
    member this.addBtn : RadButton = this.FE ? addBtn

    member this.addCadidate_Click (sender : obj) (args : RoutedEventArgs)  = 
        let inline findFirm (f : RpcXYZ.firm) =
            f.id = Int32.Parse(this.firm.SelectedValue.ToString())

        let candidate : SalesRep = {
            id = -1 ; 
            fname =  this.fname.Text ;
            lname = this.lname.Text ;
            email = this.email.Text ;
            phone = "" ;
            firm = List.find findFirm <| RpcXYZ.getFirms();
            score = None ;
        }

        // this line is fine t is a list of 1 item after 1 click
        let t = candidate :: (!this.brokers)

        // this line doesn't seem to work
        this.brokers := candidate :: (!this.brokers)

        ChildWindow().Show()  |> ignore ;

    member this.email_Changed (o : obj) (arg : TextChangedEventArgs) = 
        let txtBox = (o :?> TextBox)
        let emailRegex = Regex("(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})")
        if emailRegex.IsMatch(txtBox.Text) = false then
            txtBox.Background <- SolidColorBrush(Colors.Red)
            this.addBtn.IsEnabled <- false
        else
            txtBox.Background <- new SolidColorBrush(Colors.White)
            this.addBtn.IsEnabled <- true
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:28:48+00:00Added an answer on May 16, 2026 at 11:28 am

    This

    member this.brokers = ref List.Empty
    

    defines a property getter. Every time you touch .brokers, it re-runs the code on the right hand side. That’s the issue.

    The fix would be to define an instance variable, and return that:

    let brokers = ref List.Empty
    member this.Brokers = brokers
    

    Then a single ref is allocated when an instance of the class is constructed, and you keep accessing that same ref object via the member property.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just getting back into coding after a few year hiatus and I'm trying
I'm moving back into full time web development after a 5 year hiatus. My
After debugging a CodeIgniter application that were installed into a new development environment, I
After reading the Head First Design Patterns book and using a number of other
I've recently returned to C++ development after a hiatus, and have a question regarding
After writing and reading an xml string to and from a stream, it ceases
After starting out with Python on Ubuntu Linux, I've now for a good while
After deploying a complete application using Entity Framework (EF) and LINQ, the next things
After some research and little afford from myself I got this: $query .= SELECT
I'm relearning Haskell after a 10 year hiatus, partly to see what's changed and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.