Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 1st, 2008, 10:07 PM
Registered User
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running a program off the network?

I have created a little program that has a webbrowser in it. The webbrowser has a URL on the network. When I compile the program, I get an exe file that I can run. The program works when the exe file is on the local harddrive. When I move the exe file to the network, it no longer works and I get an error message when I run it.

Any suggestions would be greatly appreciated.

Thanks,
Mike
 
Old April 2nd, 2008, 12:23 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Is the URL relative? Do you assemble the string you are using for the URL through "reading" properties of the app (like where it is running) that would change by running it from a different location?

What is the error message you get (not the number, the message)?
Does it arise when you launch the app, or only when you take a particular action?
 
Old April 2nd, 2008, 07:50 PM
Registered User
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for taking the time to respond.

The URL is Z:\public\program\notice And that is the folder I have moved the exe into.

The error message is very generic. It just says "Notice has encountered a problem and needs to close. We are sorry for the inconvenience." It goes on to say "If you were in the middle of something, the information you were working on might be lost. Please let Microsoft about this problem . . . ." It then gives you an option to send an Error Report.

Any suggestions?
 
Old April 3rd, 2008, 11:46 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I suggest you add a sub to your app that takes a Strng argument, and writes it to a file.
Let's say it is Public Sub Say (Text As String).

Then repeatedly in your code add
Code:
    Say "Opening Folder"
(or whatever you are about to do in the program flow.) You can concatenate values, what time it is, and so on. This way you can read through that log file, and see what your app was able to accomplish, and where the problem happens—exactly. (One you get to the general area of the error, you can remove the "Say" statements that are nowhere near the pproblem, and add more detail reporting in the vicinity of the problem.)

Once you have found where the problem is, you can try various work-arounds to see if you can find a way to accomplish your task.

Or, if this gives you insight, you can post that insigt here so that maybe a solution can be discovered.

One thing you can report is:
Code:
Private Declare Function GetUserName _
                Lib "advapi32.dll" _
                Alias "GetUserNameA" (ByVal lpBuffer As String, _
                                               nSize As Long _
                                     ) As Long

...

    Dim lngCnt  As Long
    Dim lngRtrn As Long
    Dim sUserNm As String * 150

    lngRtrn = GetUserName(sUserNm, 149)
    lngCnt  = InStr(sUserNm, Chr$(0))

    If lngCnt < 2 Then
        Say "No UserName obtained by GetUserName()."
    Else
        sUserNm = Left$(sUserNm, lngCnt - 1)
        Say "UserName = """ & sUserNm & """"
    End If
    If you find a distinct difference in the username, perhaps you'll uncover a permission issue. Who knows?

 
Old April 3rd, 2008, 02:22 PM
Registered User
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Brian. I appreciate your help. However, that coding you suggested would be longer than my entire program. The only code I have is as follows:

Public Class Form1

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Close()
    End Sub


End Class

That's it. It is one form with 2 objects on it. The Webbrower that points to the html file it is to display, and the Close Button.

I am really new to Visual Basic 2008. Never used 2005, and only experience is with VB6.

Do you know of a way to create a single instance program? So that I don't have to run through an installation process to run the program?

Thanks for your time,
Mike





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem running Application on network hellian Apache Tomcat 1 June 7th, 2007 11:44 PM
running ROBOCOPY on network share? froztbyte Classic ASP Professional 0 September 28th, 2006 08:26 PM
Exception in running a program furqanms Java Basics 2 June 21st, 2006 10:39 PM
How do I setup a program on a network? tim33_909 VS.NET 2002/2003 2 November 10th, 2003 03:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.