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

  • SEARCH
  • Home
  • 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 8590603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:19:54+00:00 2026-06-11T23:19:54+00:00

I have a slider element in my windows phone app which has min value=1

  • 0

I have a slider element in my windows phone app which has min value=1 and max value=10 and by default the value is 1 when page loads. I want the value of the slider to be shown in a text block. so 1st I am storing the value of the slider in an integer when the values of slider changes using ValueChanged event. I have following code in this event handler.

private void complexitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
          int complexity;
          complexity =(int)complexitySlider.Value; //<--null reference
        }

but when I run my application, it shows the NullReference error. I have cross checked the name of the slider, its correct.
How can I remove this bug? I don’t want to directly bind the text block with slider value

  • 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-06-11T23:19:55+00:00Added an answer on June 11, 2026 at 11:19 pm

    well, it might help you to avoid NRE.

    private void SliderValueChanged(object sender, RoutedPropertyChangedEventArgs<double> args)
    {
       int complexity;
       var slider = sender as Slider;
       if(slider != null) 
       {
         complexity =(int)slider.Value;
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a slider on my page. What I want to do is, to
I have Slider in my app that is connected to a few methods. In
I have a slider with 3 slides - Intro, Question, Submit. Now I want
I have a slider that has a fade-in and fade-out transition. It basically cycles
I have a slider that returns values from 0.0f to 1.0f. I want to
I have a slider with 4 elements whose any of them has the class
I have a jQuery UI slider in which if the user types numbers into
I have a slider which keeps animating the background images.The background images are being
I have a simple slider and I want that if a certain tab is
I am making a portfolio website and have a horizontal slider which will slide

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.