Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is ObjectContext Object in VB.Net or VB6.
What is GetObjectContext function used for.
Can someone provide any concrete example of its use.


The reason I am asking this question is that I am in the process of converting a COM object written in VB6 to VB.Net.
There was some code using ObjectContext which did not make any sense.

Here is the code..

///////////////////////////////////////////
VB
Dim objvar As String

Set objCtx = GetObjectContext()

objvar = "HRA.NQAGGR"

Set objscrid = CreateObject(objvar)

funcnretval = CallByName(objscrid, screenID, VbMethod, uparray, downarray, tpcode)

If Not objCtx Is Nothing Then
  objCtx.SetComplete
End If

////////////////////////////////////////

As you can see in the code, the objectcontext is created and then SetComplete without actually being used. It does not make sense. I was wondering whether I could just ignore this code in the new Vb.Net conversion of the COM object.
Posted
Updated 8-Jan-14 17:23pm
v2

1 solution

I found the responses to this stackoverflow post[^] particularly useful - especially the one from PatFromCanada.

As to whether you can ignore it in the new version that depends on how you are going about your conversion

See these other resources which may help
http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext(v=vs.110).aspx[^]

and
https://support.microsoft.com/kb/238274[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900