Talk:Visual Basic/Snippets

For reversing a string, very slightly optimized version from that given would be:

Private Function ReverseStr(ByVal IPStr As String) As String Dim i As Integer For i = 1 To Len(IPStr) ReverseStr = Mid$(IPStr, i, 1) & ReverseStr Next End Function

The changes are that the index (i) goes forward instead of backwards. But the characters are added backwards instead of forwards.

If you really want to optimize it, create the string once with the proper length, so it is only allocated once. The above code would mean one (behind-the-scenes) call to SysReAllocString per loop iteration. Like this...

Private Function ReverseStr(ByVal IPStr As String) As String Dim i As Long, j As Long, n As Long n = Len(IPStr) j = n  ReverseStr = Space$(n) For i = 1 To Len(IPStr) Mid$(ReverseStr, i, 1) = Mid$(IPStr, j, 1) j = j - 1 Next End Function

need for help
Hello Sir Since you are in contact with experts in computer programming, I kindly ask you for TWO favors: FIRST: I want to build an application having a command button that can connect me through my modem to my ISP: IDM. Please, can you tell me what are the instructions that must be put in the code of the cmd if I am using Visual Basic 6.0???

SECOND: If I want to load the Dial-up connection in the Network Connections folder, I cannot construct the path that I should include in the "Shell" instruction. What is the path to the Dial-up connection? Your help is highly appreciated and I thank you in advance. Best Regards Please e-mail me the answer if you don't mind

magids18@inco.com.lb

Majid