To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > Visual Basic .NET

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old May 23rd, 2007, 02:08 PM   #1
smilbuta
Lively Member
 
smilbuta's Avatar
 
Join Date: Apr 05
Location: Orlando
Posts: 104
smilbuta is an unknown quantity at this point (<10)
WNETAddConnection2 Error Codes.

Hello community

I am trying to decipher how to translate my error code i get when trying to connect. my error is 1168

I have read over the getLastError method but i obviously dont know how to use it.

here is an example of how i tried,

Code:
Public Function MapDrive(ByVal DriveLetter As String, ByVal UNCPath As String, ByVal uName As String, ByVal pWord As String) As Boolean
        Dim nr As NETRESOURCE
        Dim strUsername As String
        Dim strPassword As String
        nr = New NETRESOURCE


        nr.lpRemoteName = UNCPath
        nr.lpLocalName = DriveLetter & ":"

        nr.dwType = RESOURCETYPE_DISK

        strUsername = uName
        strPassword = pWord

        Dim result As Integer
        Try
            result = WNetAddConnection2(nr, strPassword, strUsername, 0)
        Catch ex As Exception
            MessageBox.Show("error: " & vbCrLf & ex.Message.ToString)
        End Try

        If result = 0 Then
            MessageBox.Show(result)
            Return True
        Else
            MessageBox.Show(errmsg = GetLastError(result))
            Return False
        End If
    End Function
Any advice would be most helpfull including a simple code example on how to pass the error value to the method.
__________________
VB.Net uber-noob since04, Yeababy!
smilbuta is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic .NET


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:32 PM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.