Solved

Vb.Net - Post Conversion Upgrade Warnings

Posted on 2013-12-26
8
316 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
  • 5
  • 3
8 Comments
 
LVL 62

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 62

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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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 62

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 62

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 62

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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