Solved

Visual basic Question??

Posted on 1998-05-30
3
181 Views
Last Modified: 2013-11-25
We have "Temp" variable that has "C:hlrs\hrlslog.log" string.
      It empty in the beggining.
      When we install back-end(Visual basic program) we will specify where we want our data( which comes from
      the Access Database)to be copied to. Right now , we are using drive, dir list controls to specify destination
      point.But, now the client want us to use Universal Naming convention. The person when install the software will
      choose the server desination(UNC) from the list box
      and then the programm will copy automatically the 'Test' variable with the decomposed data to UNC +
      filename string.
      Any suggestions????????
I was thinking about WNetAddConnection API Call, but I don't know how it works.Does anybody has a code???    
0
Comment
Question by:gima
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:trkcorp
ID: 1462119
Does anyone speak English?
0
 
LVL 4

Expert Comment

by:zsi
ID: 1462120
trkcorp,

Please be a little more sensitive to the fact that not everyone here speaks the same language as you.  This is the Internet, after all.

Besides, before you go off criticising people's English, you might want to brush up on your own grammer skills. :)
0
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 40 total points
ID: 1462121
gima,

Try this code:

Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Private Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long

Private Sub Command1_Click()
 'To add the connection supply the following info. correctly:
 '1- A valid server and sharename is your network organization.
 '2- Your password that provide permission to the resource.
 '3- Local name.

 Call WNetAddConnection("\\dpcnt7\share", "dpcadmin2", "Y:")
End Sub

Private Sub Command2_Click()
 'To cancel a network connection
 Call WNetCancelConnection("Y:", 0)
End Sub


Best regards
Bin Huwairib
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question