Hi. Can I 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. Please, can you tell me what are the instructions that must be put in the code of the command button 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. IF the SHELL function doesn't work for such programs, what statement should be typed to open a dial-up connection???
Your help is highly appreciated and I thank you in advance.
Best Regards
Majid

Dani AI

Generated

Quick, practical answer for (and thanks to for pointing to a sample): there are two easy approaches and one robust approach.

For a simple button that dials: call Windows' built-in rasdial from VB6 with Shell. The connection name must match exactly (including spaces). Examples:

' Dial an entry that already stores credentials
Shell "rasdial ""My ISP Connection""", vbNormalFocus

' Dial and pass user/password (less secure - avoid on shared machines)
Shell "rasdial ""My ISP Connection"" myuser mypassword", vbNormalFocus

To open Network Connections or the standard dial UI instead of dialing directly, use the Control Panel applet or the phonebook UI:

' Open Network Connections
Shell "control.exe ncpa.cpl", vbNormalFocus

' Open the Phonebook / dialer UI for a named entry (shows UI)
Shell "rasphone -d ""My ISP Connection""", vbNormalFocus

If you need programmatic control (status updates, callbacks, reliable disconnects), use the Windows RAS API from VB6 (RasDial/RasHangUp and related structures). That takes more DECLAREs and error handling but is the correct long-term solution; the sample linked is a good starting point for that route.

Troubleshooting & cautions:

  • Test the rasdial/rasphone commands first at a command prompt to confirm the connection name and credentials.
  • Quote names with spaces exactly as shown in Network Connections.
  • Avoid passing passwords on the command line (they can be exposed); prefer saved phonebook credentials or prompt the user.
  • On modern Windows, UAC or permissions can block actions—run with appropriate rights when testing.
  • If Shell reports “not found,” run the command manually (System32 is normally on PATH) or check for 32/64-bit path redirection issues.

These options cover quick UI-based dialing and a simple programmatic dial; choose rasdial/rasphone for quick work and the RAS API when you need reliable program control.

Hi Majid from Spain, I know a litte Englis, y read your problem and I have one soution, I think it's good for you.
See:
http://www.freevbcode.com/ShowCode.asp?ID=2089

Miuca
:) Saludos desde Barcelona :)

Hi. Can I 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. Please, can you tell me what are the instructions that must be put in the code of the command button 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. IF the SHELL function doesn't work for such programs, what statement should be typed to open a dial-up connection???
Your help is highly appreciated and I thank you in advance.
Best Regards
Majid

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.