Click here to Skip to main content
15,918,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I migrated application from vb to vb.net I am facing one issue. That is, my application getting data from vc++ dll code is

With mobjReply 
  str =Trim(.GetRecord(0)(0).ToString())
  str2= Trim(.GetRecord(0)(1).ToString())
End With  


VB application giving correct data like name, and phone but vb.net giving {System.__ComObject}

Please suggest how can I fetch data using vb.net /C#?

Thanks
Posted
Updated 24-Oct-22 21:32pm
v3

As I said when you posted this last time, you get "System.__ComObject" because the object does not implement ToString. The default implementation returns the class name.

You need to cast it to a normal datatype before using it.

Please, don't just delete questions because you don't like the answers, it is rude!
 
Share this answer
 
Comments
to.areeb 14-Jun-12 3:31am    
Thanks for you reply. By mistaken I posted this thread twice so I deleted one unfortunatly I havent looked your answer other wise I'll delete this thread
to.areeb 14-Jun-12 3:35am    
Please explain brief Objet doest implement ToString() I added .ToString
like (.GetRecord(0)(0).ToString()). Plese correct me If I am wrong
OriginalGriff 14-Jun-12 3:40am    
No, the object doesn't implement ToString.
When you declare a class, it inherits properties and methods from the base class: one of these is the ToString method which by default returns the name of the class. If your class does not implement a more specific ToString that returns the value of the data within your class then the default one is used, and you just get the name - as you have seen. You need to convert whatever
GetRecord(0)(0)
is returning into a type that VB understands directly before you can use class specific methods.
I can't tell you what to do wioth it, and I have not idea what type it returns! (other than __ComObject) It could be a Date, a specific structure, anything. You need to look at your code and work out what it should be! :laugh:
to.areeb 14-Jun-12 3:51am    
Thanks I am looking into code.. code is inside module not in class.
To fix the issue, you need to use .Value, like this:
Rows.Fields(0).Value.ToString
 
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