Solved

VB.Net - VB6 convert DNSClient Code

Posted on 2014-02-14
6
357 Views
Last Modified: 2014-02-28
Good Day Experts!

I have converted a VB6 project to VB 2005 and there was some code conversion I am having trouble with.  

VB6
Dim oDNS
Set oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")
Dim strFoundIPaddress
oDNS.ServerAddresses = "555.555.55.55"
oDNS.Separator = ", "
On Error Resume Next
oDNS.Resolve "Test.com", strFoundIPaddress, "C_IN", "T_A"

Converted 2005
Dim oDNS As Object
oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")
Dim strFoundIPaddress As Object
'UPGRADE_WARNING: Couldn't resolve default property of object
 oDNS.ServerAddresses = "555.555.55.55"
'UPGRADE_WARNING: Couldn't resolve default property of object oDNS.Separator. oDNS.Separator = ", "            
'UPGRADE_WARNING: Couldn't resolve default property of object
On Error Resume Next
oDNS.Resolve.oDNS.Resolve("Test.com", strFoundIPaddress, "C_IN", "T_A")

I have searched the net for assistance but I didn't find anything.

Do you have any suggestions that may help me out?

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
  • 4
  • 2
6 Comments
 
LVL 5

Expert Comment

by:advfinance
ID: 39858906
oDNS.ServerAddresses

Open in new window

will probably be an instance of a class type. Find out what the default property is for that class and change
oDNS.ServerAddresses = "555.555.55.55"

Open in new window

to use that property. So if the default property is "Value", change that line to
oDNS.ServerAddresses.Value = "555.555.55.55"

Open in new window

.

If that works, repeat for the other lines with warnings.

--
Chris
0
 

Author Comment

by:Jimbo99999
ID: 39874068
Thanks for responding Chris.  I am finally able to get back to this project and I will try out your suggestions.

Thanks,
jimbo99999
0
 

Author Comment

by:Jimbo99999
ID: 39882654
Hello Chris:

I look for the reference you mentioned( instance of a class) in the code but did not find it.  

The above code was just at the top of a subroutine in the VB6 version:

Dim oDNS
Set oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")
Dim strFoundIPaddress
oDNS.ServerAddresses = "555.555.55.55"
oDNS.Separator = ", "
On Error Resume Next
oDNS.Resolve "Test.com", strFoundIPaddress, "C_IN", "T_A"
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 5

Accepted Solution

by:
advfinance earned 500 total points
ID: 39885192
I was wrong, I found the source code for the component you're using (http://www.codeguru.com/cpp/i-n/internet/dns/article.php/c6173/Simple-DNS-Resolver-v15.htm from http://www.codeguru.com/cpp/i-n/internet/dns/article.php/c6173/Simple-DNS-Resolver-v15.htm - not sure if it's the same version you're using). "ServerAddresses" is just a string property of the SimpleDNSClient class. Does the code actually run?

--
Chris
0
 

Author Comment

by:Jimbo99999
ID: 39891887
Good Day

The code runs but it I am not getting the IP Address in the strFoundIPaddress variable.  
I guess I am not really understanding why/what the oDNS.Resolve is trying to resolve.  
Why can't they just put the IP Address in there or is it not known...I don't know.

Thanks,
jimbo99999
0
 

Author Closing Comment

by:Jimbo99999
ID: 39895008
Thanks for your help.  It was determinied that I do not need to use the block of code.  However, I appreciate the links you included...they will be a nice addition to my knowledge base.

Thanks,
jimbo99999
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
UDP Data Capture Thread Issue 7 44
reading an excel file vb.net 2 47
How to call new form in VB2013? 4 37
AD Computer Objects in VB .Net 2 21
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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