This is a migrated thread and some comments may be shown as answers.

Documentation "Buttons" not working

7 Answers 105 Views
Documentation
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 21 Aug 2012, 08:00 PM
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:

7 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 24 Aug 2012, 08:29 AM
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 >>
0
Adrian
Top achievements
Rank 1
answered on 01 Oct 2012, 09:17 PM
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
0
Accepted
Adrian
Top achievements
Rank 1
answered on 01 Oct 2012, 09:31 PM
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;
}
0
Zeeshan
Top achievements
Rank 1
answered on 06 Jul 2013, 09:45 PM
Same problem here. Please help any other great code
0
Zeeshan
Top achievements
Rank 1
answered on 07 Jul 2013, 08:40 PM
Document submit button is no working
0
Stefan
Telerik team
answered on 11 Jul 2013, 06:56 AM
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 >>
0
Zeeshan
Top achievements
Rank 1
answered on 19 Jul 2013, 09:34 PM
Ok i will to do more time... Other wise i will talk to you later
Tags
Documentation
Asked by
Stephan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Adrian
Top achievements
Rank 1
Zeeshan
Top achievements
Rank 1
Share this question
or