• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Forms

Can I have a main menu form with buttons and clicking on this buttons call forms from different projects say forms includeded in project1 and project2. Please help me with this.
Is it possible to call to projects from one main form
Please let me know
0
rekha26
Asked:
rekha26
1 Solution
 
alokanantCommented:
it can be possible, if u create a project group and include the two projects in the same group.
0
 
mcriderCommented:
What you want to do is add the forms you want to use into your new project...

To do this, click the add form icon or PROJECT->Add Form

Select the "Existing" tab and select the form you want...


A couple of words of warning...

1) If the name of the form you want to add already exists in your project, you will have to rename the existing form before you can add it.

2) Once you have added a form to a project, any changes you make to that form will also be made in the old project unless you right-click on the form in the Project Box and do a "Save as..." for the form you have added...


Cheers!
0
 
deightonCommented:
'call your other projects from a central 'menu in VB like this'

Private Sub Command1_Click()
'example click event you'll have one for each compiled project
Me.Hide
DoEvents
ExecCmd ("notepad.exe")
DoEvents
Me.Show
DoEvents

End Sub

in .bas module

Option Explicit

Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function GetModuleUsage Lib "kernel32" (ByVal hModule As Integer) As Integer

    Declare Function GetSystemMenu Lib "User32.dll" (ByVal hWnd As Integer, _
     ByVal bRevert As Integer) As Integer
     Declare Function RemoveMenu Lib "User32.dll" (ByVal hMenu As Integer, _
     ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
     
     Global Const MF_BYPOSITION = &H400


Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long





      Private Type STARTUPINFO

         cb As Long
         lpReserved As String
         lpDesktop As String
         lpTitle As String
         dwX As Long
         dwY As Long
         dwXSize As Long
         dwYSize As Long
         dwXCountChars As Long
         dwYCountChars As Long
         dwFillAttribute As Long
         dwFlags As Long
         wShowWindow As Integer
         cbReserved2 As Integer
         lpReserved2 As Long
         hStdInput As Long
         hStdOutput As Long
         hStdError As Long
      End Type

      Private Type PROCESS_INFORMATION
         hProcess As Long
         hThread As Long
         dwProcessID As Long
         dwThreadID As Long
      End Type

      Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
         hHandle As Long, ByVal dwMilliseconds As Long) As Long

      Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
         lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
         lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
         ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
         ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
         lpStartupInfo As STARTUPINFO, lpProcessInformation As _
         PROCESS_INFORMATION) As Long

      Private Declare Function CloseHandle Lib "kernel32" (ByVal _
         hObject As Long) As Long

      Private Const NORMAL_PRIORITY_CLASS = &H20&
      Private Const INFINITE = -1&

      Public Sub ExecCmd(cmdline As String)
         Dim proc As PROCESS_INFORMATION
         Dim start As STARTUPINFO
         Dim ret As Long

         ' Initialize the STARTUPINFO structure:
         start.cb = Len(start)

         ' Start the shelled application:
         ret = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
            NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)

         ' Wait for the shelled application to finish:
         ret = WaitForSingleObject(proc.hProcess, INFINITE)
         ret = CloseHandle(proc.hProcess)
      End Sub



Public Function GetSetting(ByVal sFilePath As String, ByVal sSection As String, ByVal sSetting As String, Optional ByVal sDefault As Variant)

'Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA"
'(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String,
'ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

    Dim sReturn As String * 4096
    Dim lLen As Long
    Dim lReturn As Long
    Dim sDEF As String
    Dim lPos As Long
   
    sDEF = "NOT FOUND"
   
    lLen = 4096
    sReturn = Chr(0)
   
    lReturn = GetPrivateProfileString(sSection, sSetting, sDEF, sReturn, lLen, sFilePath)
       
    lPos = 1
   
    While Mid(sReturn, lPos, 1) <> Chr(0) And lPos <= Len(sReturn)
   
        GetSetting = GetSetting & Mid(sReturn, lPos, 1)
       
        lPos = lPos + 1
       
    Wend
   
End Function
   
   
   
   
   
   
   
Public Function TempFile() As String

    Dim sPath As String
    Dim sFile As String
   
    Dim iGeneric As Integer
   
    sPath = String(256, 0)
    sFile = String(256, 0)
   
    Call GetTempPath(Len(sPath), sPath)
    sPath = Left(sPath, InStr(sPath, Chr(0)) - 1)
   
    Call GetTempFileName(sPath, "AJD", 0&, sFile)
    TempFile = Left(sFile, InStr(sFile, Chr(0)) - 1)
   
   
End Function
0
 
ChasDevlinCommented:
Use "shell"
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now