Solved

Vb.Net - Post Conversion Upgrade Warnings

Posted on 2013-12-26
8
319 Views
Last Modified: 2014-01-02
Good Day Experts!

I have my VB6 project upgraded to VB.Net 2005 with the help of FernandoSoto.  I only had 1 error at the bottom of my VB.Net editor and I was able to resolve it without much trouble.  

However, I have many warnings within my code from the conversion process as below...

"UPGRADE_WARNING: Couldn't resolve default property of object..."

There are no "blue squiggly" error lines under the code that each of these UPGRADE_WARNINGS are referring to.

Since there are no errors, do I have to do anything with these? If so, in general what do I have to do with them?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39740021
Hi jimbo99999;

Try and see if this this the cause of the "UPGRADE_WARNING" in the project.

Late-bound default property reference could not be resolved
0
 

Author Comment

by:Jimbo99999
ID: 39740054
Thanks for responding Fernando.

Ok, I checked out your link but that was not the scenario with the textbox that I have here.
But it made me think...if I may run this by you.  Most of the issues have .Value at the end.

Here is an example:

Dim ShipFromZip As Object
ShipFromZip = rs.Fields("shipfromzip").Value

When I take the .Value off the end, intellisense provides Value as a valid selection.  So I am not sure what it is barking at.

Here is another example:

Dim d As mshtml.HTMLDocument
d.body.all("txtName").Value = "User"

When I take the .Value off the end, intellisense does not provide Value as a valid selection.  So I am not why it is not giving me an error or even if that is why the UPGRADE_WARNING is present.

Thanks,
jimbo99999
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39740094
Hi jimbo99999;

In this statement, "ShipFromZip = rs.Fields("shipfromzip").Value", what is the type of object of rs?

In this statement, "d.body.all("txtName").Value = "User"", the object d being  an object HTMLDocument the method body should return the document body but I am not sure what the method All("txtName") does. In .Net properties are usually called Text and Not Value.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Jimbo99999
ID: 39740134
Dim rs As ADODB.Recordset
Dim ShipFromZip As Object
ShipFromZip = rs.Fields("shipfromzip").Value

This is up at the top of the project:
Imports VB = Microsoft.VisualBasic

I did not put it there.  Does that mean I can keep using the rs recordset?
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39740205
Hi jimbo99999;

Warnings will not stop a program from compiling. They are just that warnings to be aware of that might cause an issue. In this code you might get rid of the warning by changing the code as follows.

' From this
Dim rs As ADODB.Recordset
Dim ShipFromZip As Object
ShipFromZip = rs.Fields("shipfromzip").Value

' To This
Dim rs As ADODB.Recordset
Dim ShipFromZip As String
ShipFromZip = CType(rs.Fields("shipfromzip").Value, String)

Open in new window

0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39740218
Also you asked about this, Imports VB = Microsoft.VisualBasic, yes you do need this. some of the objects that were converted to .Net lives in that name space and if it were not there you would get errors ending with "are you missing a namespace or reference".
0
 

Author Comment

by:Jimbo99999
ID: 39740563
Excellent information...thanks.

I was looking at the original VB6 project and found something interesting.


The original --> Dim ShipFromZip
The converted--> Dim ShipFromZip As Object


What type is no type in VB6 in VB.Net?

Is that why you made it a string?

Good stuff here...not my forte but learning quite a bit.

jimbo99999
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39740833
Hi jimbo99999;

To your question, "What type is no type in VB6 in VB.Net?", not sure about VB6 for I did not use it much but the Variant Data Type in VB6 which is not explicitly declared as some other type has no specific data type. The Variant data type can not be used in VB .Net.  As far as VB .Net ALL variables must be typed. The earlier versions of VB .Net variables in the program needed to be of a specific data type. When Linq was implemented into the language variables did not need to have a specific type in the source code but the datatype was determined at compile time and this is call type inference. .Net languages are type safe and therefore by compile time the type of any variable must be determined if not by you then by the compiler.

To your question, "Is that why you made it a string?", no, from what I could see the function was returning an object of type string as an Object type and to make sure that it would function correctly with whatever function it was to interact with I cast the return too an explicit type.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb.net convert long time to mm:ss 23 35
how to make search between pages 17 60
Call a VB.net function in Javascript 6 52
vb.net dbnull syntax 1 59
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question