Solved

Vb.Net - Post Conversion Upgrade Warnings

Posted on 2013-12-26
8
317 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 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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