1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Opening A VB Project File From A VB 6.0

Discussion in 'Visual Basic ( VB )' started by naimish, Sep 7, 2009.

  1. naimish

    naimish New Member

    Introduction



    Hi Friends,

    Today morning I need to create an application which is build in VB 6.0 and I wanted to open another VBP file from my existing project.

    I Googled it a lot but couldn't found anything, however I managed to achieve it anyhow, so this would be helpful to you also.

    Background



    On Button Click, It will open a new VBP Project.

    The code



    Code: VB 6.0

    Code:
    'in General-Declarations:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
    ByVal hWnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
    
    Private Sub Form_Load()
    	'open a file
    	ShellExecute Me.hWnd, "open", "C:\Test1.vbp", vbNullString, "C:\", ByVal 1&
    End Sub
    
    Private Sub OpenAFile(strFileLocation As String)
    	'Just call the OpenAFile sub with the path of the file to open as its parameter.
    	If Dir$(strFileLocation) = "" Then
    		Exit Sub
    	End If
    	ShellExecute Me.hWnd, "open", strFileLocation, vbNullString, "C:\", ByVal 1&
    	'Example code (same effect as the examples above)
    	Call OpenAFile("C:\Test1.vbp")
    End Sub
    
    Private Sub Command1_Click()
    	OpenAFile ("C:\Test1.vbp")
    End Sub

    Thanks :)

     
  2. shabbir

    shabbir Administrator Staff Member

    Moved to forum because I its too elementary to be an articles.
     

Share This Page