accessing transaction items in dll

Aug 28, 2008 3 Replies

Using a dll written Visual Studio 2005, Visual Basic, this statement works: "MsgBox(Session.Transaction.Entries.Element(n).Item.ItemLookupCode)"



Using the same code in C# doesn't work, there is no 'element' property available. "Session.Transaction.Entries." is as far as it goes. And I get a build error if I force it.



Why would some methods/properties in QSRules.dll be available in VB but not C#? Using QSRules in VB there is no intellisense. Using QSRules in C# the intellisense works great but not all properties are available. Has anyone else run into this?



What am I missing? The date of my QSRules.dll file is 12/08/2006. Is there a updated version available?


This has nothing to do with QSRules. This is a syntax problem. C# does not use the same syntax to access element of a collection. Try: Session.Transaction.Entries[n].Item.ItemLookupCode

"Galen Meyer" wrote:

Dom

You are right. The syntax is different in C#. I never could get it to work trying to access the entries by index (Session.Transaction.Entries[n].Item.ItemLookupCode) or (Session.Transaction.Entries.Element(n).Item.ItemLookupCode) but the following will ieterate through all the transaction entries with all the properties available.

foreach (TransactionEntry entry in mySession.Transaction.Entries) { MessageBox.Show(entry.Item.ItemLookupCode);

}

So that will work for what I need to do. I also figured out how to get the intelesense to work in VB. You have to create another session and assign it to the session passed from RMS. Dim Ses As New QSRules.SessionClass()

Ses = Session

Then use Ses to access the methods and properties. Then everything works fine. Go figure.

Thank you for the reply. I am starting to make some progress. I appreciate your help.

Galen

While I'm asking questions I've got another one. What is the easiest way to pass session info, or the session object, to other classes or forms. Is this possible?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required