Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

VB.Net - VB6 convert DNSClient Code

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
Avatar of advfinance
advfinance
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of Jimbo99999

ASKER

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

Thanks,
jimbo99999
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"
ASKER CERTIFIED SOLUTION
Avatar of advfinance
advfinance
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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