Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Dave Kreskowiak25-Jun-14 3:22
mveDave Kreskowiak25-Jun-14 3:22 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
uglyeyes25-Jun-14 3:39
uglyeyes25-Jun-14 3:39 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Dave Kreskowiak25-Jun-14 3:51
mveDave Kreskowiak25-Jun-14 3:51 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
uglyeyes25-Jun-14 3:57
uglyeyes25-Jun-14 3:57 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Nathan Minier25-Jun-14 4:07
professionalNathan Minier25-Jun-14 4:07 
QuestionRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Nathan Minier25-Jun-14 3:59
professionalNathan Minier25-Jun-14 3:59 
AnswerRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
uglyeyes25-Jun-14 15:51
uglyeyes25-Jun-14 15:51 
QuestionHow to extract a propertybag or complex object send from VB6 through MSMQ in C# Pin
SnailsWayne24-Jun-14 22:15
SnailsWayne24-Jun-14 22:15 
Hi guys,
I'm new to VB6 and also MSMQ. I went through a lot of tutorials online but seems like there is no solution for my question.

I managed to sending from C# to C# or VB6 to VB6 but not from VB6 to C# or vice versa. So I wonder is it a way to do that or there is no way to do this kind of communication.

For example: I want to send this to MSMQ
VB
Dim PropBag As PropertyBag
Set PropBag = New PropertyBag
PropBag.WriteProperty "Customer", "Bob"
PropBag.WriteProperty "Product", "MoeHairSuit"
PropBag.WriteProperty "Quantity", 4

and get the details in C#, there is "Invalid character in the given encoding. Line 1, position 1." error when I use XmlMessageFormatter
C#
Message mes = mq.Receive(new TimeSpan(0, 0, 3));
mes.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
result = mes.Body.ToString();

I also tried to read from the stream but it come out with a weird symbol in my string. Below is the code and this is the output "늓\0„\0\b\b휖ꭑ(\0customer\0Bob\0\b\a劑틠4\0product\v\0MoeHairSuit\b調⫳ᄂ.quantity\0"
C#
Message mes;
mes = mq.Receive(new TimeSpan(0, 0, 3));
mes.BodyStream.Position = 0;
byte[] b = new byte[mes.BodyStream.Length];
mes.BodyStream.Read(b, 0, (int)mes.BodyStream.Length);
UnicodeEncoding uniCoder = new UnicodeEncoding();
result = uniCoder.GetString(b);

I get this exception "Cannot deserialize the message passed as an argument. Cannot recognize the serialization format." when using ActiveXMessageFormatter like below
C#
mes = mq.Receive(new TimeSpan(0, 0, 3));
mes.Formatter = new ActiveXMessageFormatter();
result = mes.Body.ToString();

Do you guys have any idea how to do that?
Thanks in advanced Smile | :)

modified 25-Jun-14 5:32am.

AnswerRe: How to extract a propertybag or complex object send from VB6 through MSMQ in C# Pin
Dave Kreskowiak25-Jun-14 3:02
mveDave Kreskowiak25-Jun-14 3:02 
GeneralRe: How to extract a propertybag or complex object send from VB6 through MSMQ in C# Pin
SnailsWayne25-Jun-14 14:59
SnailsWayne25-Jun-14 14:59 
GeneralRe: How to extract a propertybag or complex object send from VB6 through MSMQ in C# Pin
Dave Kreskowiak25-Jun-14 17:26
mveDave Kreskowiak25-Jun-14 17:26 
GeneralRe: How to extract a propertybag or complex object send from VB6 through MSMQ in C# Pin
SnailsWayne25-Jun-14 21:33
SnailsWayne25-Jun-14 21:33 
AnswerRe: How to extract a propertybag or complex object send from VB6 through MSMQ in C# Pin
Bernhard Hiller25-Jun-14 20:29
Bernhard Hiller25-Jun-14 20:29 
GeneralRe: How to extract a propertybag or complex object send from VB6 through MSMQ in C# Pin
SnailsWayne25-Jun-14 21:33
SnailsWayne25-Jun-14 21:33 
QuestionWant place code logic in class using Inno setup Pin
Ashfaque Hussain24-Jun-14 20:31
Ashfaque Hussain24-Jun-14 20:31 
AnswerRe: Want place code logic in class using Inno setup PinPopular
Pete O'Hanlon24-Jun-14 20:40
mvePete O'Hanlon24-Jun-14 20:40 
GeneralRe: Want place code logic in class using Inno setup Pin
Ashfaque Hussain24-Jun-14 22:00
Ashfaque Hussain24-Jun-14 22:00 
QuestionCreate Microsoft Excel in C# Pin
Jassim Rahma24-Jun-14 20:22
Jassim Rahma24-Jun-14 20:22 
AnswerRe: Create Microsoft Excel in C# Pin
Kornfeld Eliyahu Peter24-Jun-14 20:29
professionalKornfeld Eliyahu Peter24-Jun-14 20:29 
AnswerRe: Create Microsoft Excel in C# Pin
Richard Deeming25-Jun-14 1:32
mveRichard Deeming25-Jun-14 1:32 
SuggestionRe: Create Microsoft Excel in C# Pin
LucasRLS25-Jun-14 1:57
LucasRLS25-Jun-14 1:57 
AnswerRe: Create Microsoft Excel in C# Pin
Nguyen.H.H.Dang25-Jun-14 18:45
professionalNguyen.H.H.Dang25-Jun-14 18:45 
QuestionDbContext recreate with cache clear Pin
Nathan Minier24-Jun-14 3:25
professionalNathan Minier24-Jun-14 3:25 
AnswerRe: DbContext recreate with cache clear Pin
Dave Kreskowiak24-Jun-14 5:04
mveDave Kreskowiak24-Jun-14 5:04 
GeneralRe: DbContext recreate with cache clear Pin
Nathan Minier24-Jun-14 5:52
professionalNathan Minier24-Jun-14 5:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.