Documentation "Buttons" not working

8 posts, 1 answers
  1. Stephan
    Stephan avatar
    33 posts
    Member since:
    Jun 2012

    Posted 21 Aug 2012 Link to this post

    private void SizeModeClick(object sender, EventArgs e)
            {
                RadMenuButtonItem item = sender as RadMenuButtonItem;
                pictureBox1.SizeMode = (PictureBoxSizeMode)Convert.ToInt32(item.Tag);
                sbSizeMode.Text = item.Text;
            }

     

     

     

    The above code from the step by step tutorial is throwing a NullReference Exception.  I bolded the line that has the error, VS2012 says it should have a "new", but when i do that it will not compile.


    System.NullReferenceException was unhandled
      HResult=-2147467261
      Message=Object reference not set to an instance of an object.
      Source=Winformtutorial
      StackTrace:
           at Winformtutorial.RadForm1.SizeModeClick(Object sender, EventArgs e) in d:\visual studio 12\Projects\Winformtutorial\Winformtutorial\RadForm1.cs:line 43
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at Telerik.WinControls.RadControl.OnClick(EventArgs e)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at Telerik.WinControls.RadControl.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at Winformtutorial.Program.Main() in d:\visual studio 12\Projects\Winformtutorial\Winformtutorial\Program.cs:line 18
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 24 Aug 2012 Link to this post

    Hi Stephan,

    Please find the answer to your question in the support ticket which you have opened regarding the same matter - "Step by Step Tutorial not working".

    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Adrian
    Adrian avatar
    2 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    I'm having the same problem. A public solution would be much appreciated not just for me but anyone else evaluating the trial.

    Regards,
     -Adrian
  5. Answer
    Adrian
    Adrian avatar
    2 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    after a bit of experimentation I discovered that the sender object is of type RadMenuItem when in the click event. Modifying the SizeModeClick method as follows produces the desired results:

    private void SizeModeClick(object sender, EventArgs e)
    {
        RadMenuItem item = sender as RadMenuItem;
        pictureBox1.SizeMode = (PictureBoxSizeMode)Convert.ToInt32(item.Tag);
        sbSizeMode.Text = item.Text;
    }
  6. Zeeshan
    Zeeshan avatar
    19 posts
    Member since:
    Jun 2013

    Posted 06 Jul 2013 Link to this post

    Same problem here. Please help any other great code
  7. Zeeshan
    Zeeshan avatar
    19 posts
    Member since:
    Jun 2013

    Posted 07 Jul 2013 Link to this post

    Document submit button is no working
  8. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 11 Jul 2013 Link to this post

    Hi Zeeshan,

    Can you please provide more details on your case so we have information to work with? What is the "same problem" you experience? Which is the button you mention that is not working?

    Thank you in advance for your cooperation. 

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  9. Zeeshan
    Zeeshan avatar
    19 posts
    Member since:
    Jun 2013

    Posted 19 Jul 2013 Link to this post

    Ok i will to do more time... Other wise i will talk to you later
Back to Top
UI for WinForms is Visual Studio 2017 Ready