[HELP] vb 6.0 > vb.NET

Posts 1–9 of 9 · Page 1 of 1
[HELP] vb 6.0 > vb.NET
hey

it seems visual basic 2008 do not support this anymore:

Code:
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyname As Any, ByVal lpString As String, ByVal lpfilename As String) As Long
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyname As Any, ByVal lpdefault As String, ByVal lpreturnedstring As String, ByVal nsize As Long, ByVal lpfilename As String) As Long
do anybody know the code from this in visual basic 2008?

thanks!
Windows API calls are supported in VB.NET but the keyword Any is no longer supported. You can replace Any with String since you are reading and writing to the INI file.
Quote Originally Posted by Born2Amuse View Post
Windows API calls are supported in VB.NET but the keyword Any is no longer supported. You can replace Any with String since you are reading and writing to the INI file.
Good point, but you know what would really help him understand, why don't you go ahead and explain to him the differences between each, and also the reason for the change.

Also, explain to him why string will work in this situation, and not one of the other options that could be available, he needs to learn, and I think you can show him how to.

Giving the answer is never enough
The keyword Any was used in VB6 the same way Object type is used in VB.NET. It implicitly converts the entered type to required type by the API call. The reason this keyword is not supported is because of the many enhancements of type conversion in .NET and safer execution. VB.NET wants you to take care of it. Object type can mostly be used in place of Any. This will take care of most of the API's. But the best method is always to use the desired data type.
Quote Originally Posted by NextGen1 View Post


Good point, but you know what would really help him understand, why don't you go ahead and explain to him the differences between each, and also the reason for the change.

Also, explain to him why string will work in this situation, and not one of the other options that could be available, he needs to learn, and I think you can show him how to.

Giving the answer is never enough
Lol, NG don't you know that ? You should've told him. And 100 % agree with new guy. Looks like we have new pro in town ;]
@ hassan, of course I do, Just wanted the new guy to get use to it, these things help the ppl who ask questions, consider it his "on site training"
Finally someone that isn't just going to post a couple of webbrowsers

Welcome Born.
Thank you Blubb1337. I laughed at your avatar (:
New blood. It's been a long time coming.
Posts 1–9 of 9 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us