Question Problem with WPF Slider ValueChanged action.

Catink123

New member
Joined
Oct 18, 2017
Messages
1
Programming Experience
Beginner
So, on ValueChanged action I have this line: freqtext.Text = Convert.ToInt32(freq.Value) + " Hz";
When I compile project it starts and shows me an error:
An exception of type System.Reflection.TargetInvocationException was thrown:
System.Reflection.TargetInvocationException: ??????? ?????? ?????? ??????????. ---> System.NullReferenceException: ?????? ?? ?????? ?? ????????? ?? ????????? ???????.
? xdxdWPF.Window1.freq_ValueChanged(Object sender, RoutedPropertyChangedEventArgs`1 e) ? c:\Users\qwert\Documents\SharpDevelop Projects\xdxdWPF\xdxdWPF\Window1.xaml.cs:?????? 38
? System.Windows.RoutedPropertyChangedEventArgs`1.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
? System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
? System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
? System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
? System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
? System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
? System.Windows.Controls.Primitives.RangeBase.OnValueChanged(Double oldValue, Double newValue)
? System.Windows.Controls.Slider.OnValueChanged(Double oldValue, Double newValue)
? System.Windows.Controls.Primitives.RangeBase.OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
? System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
? System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
? System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
? System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
? System.Windows.DependencyObject.CoerceValue(DependencyProperty dp)
? System.Windows.Controls.Primitives.RangeBase.OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
? System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
? System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
? System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
? System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
? System.Windows.DependencyObject.CoerceValue(DependencyProperty dp)
? System.Windows.Controls.Primitives.RangeBase.OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
? System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
? System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
? System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
? System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
? System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
? System.Windows.Baml2006.WpfMemberInvoker.SetValue(Object instance, Object value)
? MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)
? MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
? System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)
? System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)
? System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)
? System.Xaml.XamlObjectWriter.WriteEndMember()
? System.Xaml.XamlWriter.WriteNode(XamlReader reader)
? System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
? System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
? System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
? System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
? System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
? xdxdWPF.Window1.InitializeComponent() ? c:\Users\qwert\Documents\SharpDevelop Projects\xdxdWPF\xdxdWPF\Window1.xaml:?????? 1
? xdxdWPF.Window1..ctor() ? c:\Users\qwert\Documents\SharpDevelop Projects\xdxdWPF\xdxdWPF\Window1.xaml.cs:?????? 28
--- End of inner exception stack trace ---
? System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
? System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
? System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
? System.Activator.CreateInstance(Type type, Boolean nonPublic)
? System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
? System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
? System.Activator.CreateInstance(Type type, Object[] args)
? System.Xaml.Schema.SafeReflectionInvoker.CreateInstanceCritical(Type type, Object[] arguments)
? System.Xaml.Schema.SafeReflectionInvoker.CreateInstance(Type type, Object[] arguments)
? System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments)
? MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args)
? MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)
? System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
? System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
? System.Xaml.XamlWriter.WriteNode(XamlReader reader)
? System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
? System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
? System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
? System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
? System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
? System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
? System.Windows.Application.DoStartup()
? System.Windows.Application.<.ctor>b__1_0(Object unused)
? System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
? System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
? System.Windows.Threading.DispatcherOperation.InvokeImpl()
? System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
? System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
? System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
? System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
? MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
? System.Windows.Threading.DispatcherOperation.Invoke()
? System.Windows.Threading.Dispatcher.ProcessQueue()
? System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
? MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
? MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
? System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
? System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
? System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
? MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
? MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
? System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
? System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
? System.Windows.Application.RunDispatcher(Object ignore)
? System.Windows.Application.RunInternal(Window window)
? System.Windows.Application.Run(Window window)
? System.Windows.Application.Run()
? xdxdWPF.App.Main() ? c:\Users\qwert\Documents\SharpDevelop Projects\xdxdWPF\xdxdWPF\obj\Debug\App.g.cs:?????? 0
Sorry for "?"s .
 
Last edited:
Back
Top Bottom