469,602 Members | 1,838 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Connecting to internet question

When I use this class below it says "Name 'config' not
declared" for the following line:

Dim sMethod As String = config.AppSettings("DialupMethod")

How do I declare this guy?

Thanks,

Bob
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++
+++++++
' Dialer Class
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++
+++++++
Public Class InternetDialer
Public Declare Function InternetAutodial
Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As
Long

'flags for InternetAutodial
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2

Private Declare Function InternetAutodialHangup
Lib "wininet.dll" _
(ByVal dwReserved As Long) As Long

Public Sub Dialup()
Try
Dim sMethod As String = config.AppSettings
("DialupMethod")

Select Case sMethod
Case "Prompt" 'To prompt the user to
connect to the Net
InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0&)
'InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0)

Case "Auto" 'To automatically start
dialling
InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0&)

'InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0)
End Select
Catch ex As Exception

End Try
End Sub

Public Sub HangUp()
'To disconnect an automatically dialled connection
InternetAutodialHangup(0&)
End Sub

End Class

Nov 21 '05 #1
3 2764
ConfigurationSettings.AppSettings("DialupMethod")
--
Gerry O'Brien
Visual Basic .NET MVP
"BobAchgill" <an*******@discussions.microsoft.com> wrote in message
news:1d****************************@phx.gbl...
When I use this class below it says "Name 'config' not
declared" for the following line:

Dim sMethod As String = config.AppSettings("DialupMethod")

How do I declare this guy?

Thanks,

Bob
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++
+++++++
' Dialer Class
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++
+++++++
Public Class InternetDialer
Public Declare Function InternetAutodial
Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As
Long

'flags for InternetAutodial
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2

Private Declare Function InternetAutodialHangup
Lib "wininet.dll" _
(ByVal dwReserved As Long) As Long

Public Sub Dialup()
Try
Dim sMethod As String = config.AppSettings
("DialupMethod")

Select Case sMethod
Case "Prompt" 'To prompt the user to
connect to the Net
InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0&)
'InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0)

Case "Auto" 'To automatically start
dialling
InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0&)

'InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0)
End Select
Catch ex As Exception

End Try
End Sub

Public Sub HangUp()
'To disconnect an automatically dialled connection
InternetAutodialHangup(0&)
End Sub

End Class

Nov 21 '05 #2
I tried putting that line in the code below and still
come up with declaration error... but now on the line you
suggest.

Hummm??

-----Original Message-----
ConfigurationSettings.AppSettings("DialupMethod ")
--
Gerry O'Brien
Visual Basic .NET MVP
"BobAchgill" <an*******@discussions.microsoft.com> wrote in messagenews:1d****************************@phx.gbl...
When I use this class below it says "Name 'config' not
declared" for the following line:

Dim sMethod As String = config.AppSettings ("DialupMethod")
How do I declare this guy?

Thanks,

Bob
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++ +++++++
' Dialer Class
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++ +++++++
Public Class InternetDialer
Public Declare Function InternetAutodial
Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As
Long

'flags for InternetAutodial
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2

Private Declare Function InternetAutodialHangup
Lib "wininet.dll" _
(ByVal dwReserved As Long) As Long

Public Sub Dialup()
Try
Dim sMethod As String = config.AppSettings
("DialupMethod")

Select Case sMethod
Case "Prompt" 'To prompt the user to
connect to the Net
InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0&)
'InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0)

Case "Auto" 'To automatically start
dialling
InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0&)

'InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0)
End Select
Catch ex As Exception

End Try
End Sub

Public Sub HangUp()
'To disconnect an automatically dialled connection InternetAutodialHangup(0&)
End Sub

End Class

.

Nov 21 '05 #3
Do you have System.Configuration imported at the top of your code file?

--
Gerry O'Brien
Visual Basic .NET MVP
"BobAchgill" <an*******@discussions.microsoft.com> wrote in message
news:8b****************************@phx.gbl...
I tried putting that line in the code below and still
come up with declaration error... but now on the line you
suggest.

Hummm??

-----Original Message-----
ConfigurationSettings.AppSettings("DialupMethod" )
--
Gerry O'Brien
Visual Basic .NET MVP
"BobAchgill" <an*******@discussions.microsoft.com> wrote

in message
news:1d****************************@phx.gbl...
When I use this class below it says "Name 'config' not
declared" for the following line:

Dim sMethod As String = config.AppSettings ("DialupMethod")
How do I declare this guy?

Thanks,

Bob
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++ +++++++
' Dialer Class
'
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++ +++++++
Public Class InternetDialer
Public Declare Function InternetAutodial
Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As
Long

'flags for InternetAutodial
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2

Private Declare Function InternetAutodialHangup
Lib "wininet.dll" _
(ByVal dwReserved As Long) As Long

Public Sub Dialup()
Try
Dim sMethod As String = config.AppSettings
("DialupMethod")

Select Case sMethod
Case "Prompt" 'To prompt the user to
connect to the Net
InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0&)
'InternetAutodial
(INTERNET_AUTODIAL_FORCE_ONLINE, 0)

Case "Auto" 'To automatically start
dialling
InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0&)

'InternetAutodial
(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0)
End Select
Catch ex As Exception

End Try
End Sub

Public Sub HangUp()
'To disconnect an automatically dialled connection InternetAutodialHangup(0&)
End Sub

End Class

.

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by jersey | last post: by
1 post views Thread by Dishaa V | last post: by
1 post views Thread by Paras Sharma | last post: by
3 posts views Thread by chethana | last post: by
18 posts views Thread by Barry Wright | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.