[Mono-winforms-list] DataGridView DataBoundItem return NULL

Paul paul at all-the-johnsons.co.uk
Wed Nov 26 09:15:09 EST 2008


Hi,

> WinExe targets need main functions, too. How about this?
> 
> 
> // Main.cs
> using System.Windows.Forms;
> 
> namespace DataGridViewProblem
> {
	static class Program
	{
> 	static void Main()
>         {
>             Application.Run(new frmDataGridProblem());
>         }
	}
> }

That compiles and runs. When I click on the Show Current thing at the
top, mono dies with the following throwback

System.NullReferenceException: Object reference not set to an instance
of an object
  at
DataGridViewProblem.frmDataGridProblem.showCurrentRegisterToolStripMenuItem_Click (System.Object sender, System.EventArgs e) [0x00000] 
  at System.Windows.Forms.ToolStripItem.OnClick (System.EventArgs e)
[0x00000] 
  at System.Windows.Forms.ToolStripMenuItem.OnClick (System.EventArgs e)
[0x00000] 
  at System.Windows.Forms.ToolStripMenuItem.HandleClick
(System.EventArgs e) [0x00000] 
  at System.Windows.Forms.ToolStripItem.FireEvent (System.EventArgs e,
ToolStripItemEventType met) [0x00000] 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.ToolStripItem:FireEvent
(System.EventArgs,System.Windows.Forms.ToolStripItemEventType)
  at System.Windows.Forms.ToolStrip.OnMouseUp
(System.Windows.Forms.MouseEventArgs mea) [0x00000] 
  at System.Windows.Forms.Control.WmLButtonUp
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message&
m) [0x00000] 
  at System.Windows.Forms.ScrollableControl.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.ToolStrip.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.MenuStrip.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg,
IntPtr wParam, IntPtr lParam) [0x00000] 

Looking at the code, there is a public Cash Selected, but I can't see
where that is instantated from (unless Cash cash = new Cash() does it,
but I can't see how it can.

There isn't a get/set which calls Selected or anything in the form
designer.

TTFN

Paul
-- 
Sie können mich aufreizen und wirklich heiß machen!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20081126/acd8775d/attachment.bin 


More information about the Mono-winforms-list mailing list