The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Binding ES to Grids

Last post 05-23-2007, 4:39 PM by Mike.Griffin. 19 replies.
Page 1 of 2 (20 items)   1 2 Next >
Sort Posts: Previous Next
  •  05-23-2007, 9:49 AM 2664

    Binding ES to Grids

    ok, I have my ES objects, I load it with data. I have on the form I have a bindingsource, MSDatagridView, es object.

    bindingsource.Datasource = es object

    datagrid.datasource = bingingsource

    On form load I load the data and get a index error: Index -1 does not have a value.

    Am I doing this wrong with ES?

     

    Thanks,

    John

  •  05-23-2007, 9:55 AM 2665 in reply to 2664

    Re: Binding ES to Grids

    John, as the readme posts in each forum ask please post what ES version you're using and what database. Our latest version, v0521.1 is what I recommend. Also, we ask that you post your code (not the entire form just the relevent parts) and be sure to use the "code" button, it's the last toolbar button on the right when editing. Also, again, the readme asks that you post the actual callstack from the exception and format is as well using the code button, then we can help. We don't even know if you're using web or windows.forms?

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-23-2007, 10:14 AM 2666 in reply to 2665

    Re: Binding ES to Grids

    Sorry....

    Using ES v521.0 with a SQL 2005 database. This is a winform app.

    This is the only code I have right now:

    Code:
        Private Sub MSGridView_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Me._accountsCollection.LoadAll()
            Me._accountFreezeTypeCollection.LoadAll()
    
            Me._accountFreezeTypeCollectionBindingSource.DataSource = Me._accountFreezeTypeCollection
            Me._AccountsCollectionBindingSource.DataSource = Me._accountsCollection
        End Sub

    The Grid's datasource is set at design time, do I need to set is in code? 

    Here is the error:

    Code:
       at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)
       at System.Windows.Forms.CurrencyManager.get_Current()
       at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowEnter(DataGridViewCellEventArgs e)
       at System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean canCreateNewRow, Boolean validationFailureOccurred)
       at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick)
       at System.Windows.Forms.DataGridView.SetAndSelectCurrentCellAddress(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick, Boolean clearSelection, Boolean forceCurrentCellSelection)
       at System.Windows.Forms.DataGridView.MakeFirstDisplayedCellCurrentCell(Boolean includeNewRow)
       at System.Windows.Forms.DataGridView.OnEnter(EventArgs e)
       at System.Windows.Forms.Control.NotifyEnter()
       at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
       at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
       at System.Windows.Forms.ContainerControl.SetActiveControlInternal(Control value)
       at System.Windows.Forms.ContainerControl.SetActiveControl(Control ctl)
       at System.Windows.Forms.ContainerControl.set_ActiveControl(Control value)
       at System.Windows.Forms.Control.Select(Boolean directed, Boolean forward)
       at System.Windows.Forms.Control.SelectNextControl(Control ctl, Boolean forward, Boolean tabStopOnly, Boolean nested, Boolean wrap)
       at System.Windows.Forms.Control.SelectNextControlInternal(Control ctl, Boolean forward, Boolean tabStopOnly, Boolean nested, Boolean wrap)
       at System.Windows.Forms.Form.set_Active(Boolean value)
       at System.Windows.Forms.Form.ActivateMdiChildInternal(Form form)
       at System.Windows.Forms.Form.WmMdiActivate(Message& m)
       at System.Windows.Forms.Form.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.DefMDIChildProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at System.Windows.Forms.Form.DefWndProc(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.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.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       at System.Windows.Forms.Control.CreateHandle()
       at System.Windows.Forms.Form.CreateHandle()
       at System.Windows.Forms.Control.get_Handle()
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.Show()
       at NoteWorld.Demo.MainFormView.ShowIt(Form& v) in D:\NoteWorld\NSSREP\Development\NoteWorld\NoteWorld.Demo\NoteWorld.Demo\View\MainFormView.vb:line 28
       at NoteWorld.Demo.MainFormView._msGridC1Command_Click(Object sender, ClickEventArgs e) in D:\NoteWorld\NSSREP\Development\NoteWorld\NoteWorld.Demo\NoteWorld.Demo\View\MainFormView.vb:line 13
       at C1.Win.C1Command.C1Command.OnClick(ClickEventArgs e)
       at C1.Win.C1Command.C1Command.Invoke(ClickEventArgs e)
       at d6.a(C1CommandLink A_0, a A_1)
       at f.c(MouseEventArgs A_0)
       at C1.Win.C1Command.C1ToolBar.OnMouseUp(MouseEventArgs 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.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(Int32 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(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at NoteWorld.Demo.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain.nExecuteAssembly(Assembly 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  •  05-23-2007, 10:19 AM 2667 in reply to 2666

    Re: Binding ES to Grids

    We fixed a but related to this last night, the new build was pushed up, just install, regenerate and try the same code and see if it works if you would.  v0521.1

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-23-2007, 10:48 AM 2669 in reply to 2667

    Re: Binding ES to Grids

    ok, I installed the latest version v0521.1 and still got the error: "Index -1 does not have a value."

    Code:
       at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)
       at System.Windows.Forms.CurrencyManager.get_Current()
       at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowEnter(DataGridViewCellEventArgs e)
       at System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean canCreateNewRow, Boolean validationFailureOccurred)
       at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick)
       at System.Windows.Forms.DataGridView.SetAndSelectCurrentCellAddress(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick, Boolean clearSelection, Boolean forceCurrentCellSelection)
       at System.Windows.Forms.DataGridView.MakeFirstDisplayedCellCurrentCell(Boolean includeNewRow)
       at System.Windows.Forms.DataGridView.OnEnter(EventArgs e)
       at System.Windows.Forms.Control.NotifyEnter()
       at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
       at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
       at System.Windows.Forms.ContainerControl.SetActiveControlInternal(Control value)
       at System.Windows.Forms.ContainerControl.SetActiveControl(Control ctl)
       at System.Windows.Forms.ContainerControl.set_ActiveControl(Control value)
       at System.Windows.Forms.Control.Select(Boolean directed, Boolean forward)
       at System.Windows.Forms.Control.SelectNextControl(Control ctl, Boolean forward, Boolean tabStopOnly, Boolean nested, Boolean wrap)
       at System.Windows.Forms.Control.SelectNextControlInternal(Control ctl, Boolean forward, Boolean tabStopOnly, Boolean nested, Boolean wrap)
       at System.Windows.Forms.Form.set_Active(Boolean value)
       at System.Windows.Forms.Form.ActivateMdiChildInternal(Form form)
       at System.Windows.Forms.Form.WmMdiActivate(Message& m)
       at System.Windows.Forms.Form.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.DefMDIChildProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at System.Windows.Forms.Form.DefWndProc(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.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.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       at System.Windows.Forms.Control.CreateHandle()
       at System.Windows.Forms.Form.CreateHandle()
       at System.Windows.Forms.Control.get_Handle()
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.Show()
       at NoteWorld.Demo.MainFormView.ShowIt(Form& v) in D:\NoteWorld\NSSREP\Development\NoteWorld\NoteWorld.Demo\NoteWorld.Demo\View\MainFormView.vb:line 28
       at NoteWorld.Demo.MainFormView._msGridC1Command_Click(Object sender, ClickEventArgs e) in D:\NoteWorld\NSSREP\Development\NoteWorld\NoteWorld.Demo\NoteWorld.Demo\View\MainFormView.vb:line 13
       at C1.Win.C1Command.C1Command.OnClick(ClickEventArgs e)
       at C1.Win.C1Command.C1Command.Invoke(ClickEventArgs e)
       at d6.a(C1CommandLink A_0, a A_1)
       at f.c(MouseEventArgs A_0)
       at C1.Win.C1Command.C1ToolBar.OnMouseUp(MouseEventArgs 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.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(Int32 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(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at NoteWorld.Demo.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain.nExecuteAssembly(Assembly 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
     thanks,
    John
  •  05-23-2007, 10:52 AM 2670 in reply to 2669

    Re: Binding ES to Grids

    I can see this is due to some sort of mouse click, what have you done in your grid before this? Have you edited / deleted or added any rows, sorted or filtered data? I want to fix this tonight if we can repro it, perhaps you can send us a tiny app that does it, or give us the steps necessary to reproduce it.

    Thanx by the way, we have been tweaking this area an I suspect if we nail this it will be all good to go.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-23-2007, 11:08 AM 2671 in reply to 2670

    Re: Binding ES to Grids

    I didn't do anything the first time the error happens. I get the error as soon as the form loads. I can get the error again by clicking on a row in the grid.

    So I have everything setup in the designer, in the form load event I load up the data with a .loadall, run the application, click a menu item that loads the form, the error happens after the load event is done. Below would be the seq of events. The error is caught when v.show is hit in sub ShowIt.

    Code:
        Private Sub _msGridC1Command_Click(ByVal sender As System.Object, ByVal e As C1.Win.C1Command.ClickEventArgs) Handles _msGridC1Command.Click
            Dim v As New MSGridView
            ShowIt(v)
        End Sub
    
        Private Sub ShowIt(ByRef v As Form)
            v.MdiParent = Me
            v.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
            v.StartPosition = FormStartPosition.Manual
            v.Location = New Point(0, 0)
            v.Show()
        End Sub
    
        Private Sub MSGridView_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Me._accountsCollection.LoadAll()
            Me._accountFreezeTypeCollection.LoadAll()
    
            Me._accountFreezeTypeCollectionBindingSource.DataSource = Me._accountFreezeTypeCollection
            Me._AccountsCollectionBindingSource.DataSource = Me._accountsCollection
        End Sub

    I could put this app together for you if want. It is just a smiple test app to try out ES with ComponentOne controls, but was getting this error with C1 as well and wanted to see if the problem was with C1 or ES so I added MS controls to test this and got the error as well. Figured that I would get thru the MS errors first.

    Thanks,

    John

  •  05-23-2007, 11:48 AM 2672 in reply to 2671

    Re: Binding ES to Grids

    This is pretty strange since we do this all over, even the EntitySpacesDemo app you have does that all over and works fine, if you could send us a tiny sample we'll look at it. Sent it to support@entityspaces.net.

    [modified]

    Code:
    		private void DemoBasicsLoadAll()
    		{
    			prds = new ProductsCollection();
    prds.LoadAll(); this.dataGridView1.DataSource = prds; this.dataGridView1.Refresh(); }


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-23-2007, 11:54 AM 2673 in reply to 2672

    Re: Binding ES to Grids

    Where is the Demo app installed to I don't see a demo app in the ES dir? Or is it only installed with the trial version?

    I'll work on getting this put together and sent to you shortly.

     Thanks,

    John

  •  05-23-2007, 12:35 PM 2675 in reply to 2673

    Re: Binding ES to Grids

    Okay, cool. You can install the trial by the way, it's also v0521.1 and then run the EntitySpacesDemo solution, just check the config settings to connect, it uses Northwind.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-23-2007, 12:39 PM 2677 in reply to 2675

    Re: Binding ES to Grids

    ok, just sent the application.

     

  •  05-23-2007, 12:45 PM 2678 in reply to 2675

    Re: Binding ES to Grids

    One other question, If I install the trial do I need to re-install the deveoper version which it registered?
  •  05-23-2007, 12:46 PM 2679 in reply to 2678

    Re: Binding ES to Grids

    No, the trial does come with templates but they are at least for the moment the same version as the developer, the trial dlls are installed under the EntitySpacesDemo folder and will not overwrite your redistributables. However if you uninstall the trial later just reinstall the developer and you'll be fine. There are tons of grids working there.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-23-2007, 1:05 PM 2680 in reply to 2679

    Re: Binding ES to Grids

    Ok, I'm just full of issues today. I downloaded the Trial version "Subject: 45 Day Trial Version - ES 2007 v0.0521".

    I noticed in the project that the version of the dll's are v0.521.0

    I also get this error when I run it:

    Code:
    {"Could not load file or assembly 'EntitySpaces.Core, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ffa9698e2ae4439b' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"EntitySpaces.Core, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ffa9698e2ae4439b"}
    
       at EntitySpacesDemo.Demo..ctor()
       at EntitySpacesDemo.Program.Main() in C:\Program Files\EntitySpaces\EntitySpacesDemo\EntitySpacesDemo\Program.cs:line 21
       at System.AppDomain.nExecuteAssembly(Assembly 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  •  05-23-2007, 1:39 PM 2681 in reply to 2680

    Re: Binding ES to Grids

    This is probably the issue behind all the problems you are having? Did you unearth those old EntitySpaces dlls in an archaeological dig? ;)  Probably things are all confused, at some point you were supposed to uninstall all the old stuff per our release notes as things were relocated. I'm not sure what to make of it, I'd uninstall everything, delete the EntitySpaces folder entirely and reinstall fresh?

    EntitySpaces | Twitter | BLOG | Please honor our Software License
Page 1 of 2 (20 items)   1 2 Next >
View as RSS news feed in XML