Solved

Vb.Net - Post Conversion Upgrade Warnings

Posted on 2013-12-26
8
313 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now