Share via

BindingSource & 64 bit

NachitoMax 416 Reputation points
2021-12-01T01:47:26.97+00:00

Hi

Im experiencing an issue with a BindingSource and my project being 64 bit. My project is an addin that connects to a 3rd party application and there is a requirement for it to be 64 bit in order for it to work. Ive had a bindingSource in my project for about 6 months and was writing in the code for the 3rd party object today. When i changed my project to 64 bit (to be honest, i thought it already was), my form with the BindingSource threw an error

Cound not find type 'Project.DataClass'. Please make sure that the assembly that contains this type is referenced. If this is a part of your development project, make sure the project has been successfully built usingf settings for your current platform or Any CPU.

My Project.DataClass is my BindingSource Class that i use as a datasource in the form for all of the controls.

If i run the project, it operates as expected without issue but in design time, i get the error screen. If i change the project back to Any CPU, the form returns to normal design...

So,

Is a BindingSource Any CPU dependent? Does it not work in a 64 Bit environment?
Can i run it as Any CPU in a project set as 64 bit?

Here is my BindingSource Class

Imports System.ComponentModel

Public Class C_ItemData

    Private Shared _job_id As Integer
    Public Property _item_id As Integer
    Public Property _configuration As String

    Public Sub New(ByVal JobID As Integer)
        _job_id = JobID
    End Sub

    Public Sub New(ByVal item_id As Integer, ByVal configuration As String)

        Dim ConvItem As Integer = Convert.ToInt32(item_id)

        _item_id = ConvItem
        _configuration = configuration
    End Sub

    Public Shared Function GetJobItemList(ByVal JobID As Integer) As BindingList(Of C_ItemData)
        Dim JL As Proj.BLL.ItemList = New Proj.BLL.ItemList
        Dim GetList As List(Of Proj.BLL.ItemList_details) = JL.GetItemListByJobID(JobID)

        Return PopulateItemList(GetList)

    End Function

    Public Shared Function GetItemList(ByVal JobID As Integer, ByVal ItemID As Integer) As BindingList(Of C_ItemData)
        Dim JL As Proj.BLL.ItemList = New Proj.BLL.ItemList
        Dim GetList As List(Of Proj.BLL.ItemList_details) = JL.GetItemListByJobIDItemID(JobID, ItemID)
        Return PopulateItemList(GetList)
    End Function

    Private Shared Function PopulateItemList(ByVal GetList As List(Of Proj.BLL.ItemList_details)) As BindingList(Of C_ItemData)
        Dim List As BindingList(Of C_ItemData) = New BindingList(Of C_ItemData)

        For Each row As Proj.BLL.ItemList_details In GetList

            With row
                List.Add(New C_ItemData(._item_id, ._configuration))
            End With

        Next
        Return List
    End Function

End Class

and it is set to a datasource like this

ItemDataBindingSource.DataSource = C_ItemData.GetJobItemList(obID)
Developer technologies | .NET | .NET Runtime
Developer technologies | .NET | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. NachitoMax 416 Reputation points
    2021-12-01T01:58:14.97+00:00

    Got around it by late binding the datasource in runtime which allows me to see the form in designtime and use the BindingSource in runtime but why the conflict?

    Thanks

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.