Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 March 31st, 2004, 09:04 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hplim18
Default Load another project's win form from current proj

Hi all,

Do anyone know how to get access from current project to another project?

The condition is where when i am in one project, i click on a button to load up the requested another project's win form.

Urgent pls......can anyone know please help me?? Thanksssss.....

Jeannie....
__________________
Jeannie....
 
Old April 1st, 2004, 08:47 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do not think you can call another project directly but you can call an exe and pass some arguments which you can use in your other exe.

I often use this method. In the Sub Main I decode the arguments so I know what form to show and what action to perform.

Hope this helps a bit.

Greetz

Tom.
 
Old April 13th, 2004, 03:35 AM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hplim18
Default

hmmm...do you have any example on this? i could hardly figure what u trying to say. But i couldnt think of how to pass the exe and parameter in.

let's say i have a button to click on to load another project (or the exe) just like what u mean. when i click on the button, what code should i put in to load up the exe?? how to code on this?? please...



Jeannie....
 
Old April 13th, 2004, 04:46 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Let's say you click on a button and you want the exe "secondproject.exe" to start.

On the click event of the button you use the following code:

Shell GetAppPath & "secondproject"

(In my project GetAppPath returns the full path of the current application so we are assuming that secondproject.exe is in the same folder)

Now you can also add parameters to this code.
Lets say you want to pass the Id of a certain row in a table then the code would look like this.

Shell GetAppPath & "secondproject 1254"

In the secondproject we want to know what parameter has been passed so in the sub main we are going to decode this.

Sub Main()

 Dim strParameters as string
 Dim strParams() as string

 'Command$ contains the string with all the parameters that were passed.
 strParameters = Command$

 'if you pass more then one parameter you should use a delimeter like " " or "|"

 'now you can split the parameters into the different params

 strParams = split(strParameter,"your delimeter")

 'Now you have an array with all your parameters
 'in this case you could do something like this:
 if clng(strParams(0)) = 1254 then
  frmMain.Show
 else
  msgbox "Wrong id"
  end
 end if

end sub


I hope this helps a bit.
If you have anymore questions, just ask.

Greetz Tom.
 
Old April 15th, 2004, 07:30 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hplim18
Default

Thankss a lot, Tom. I will try out on this. :)

Jeannie....





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the current calling form in a class? littlekitty ASP.NET 2.0 Basics 0 October 17th, 2006 08:28 PM
How to laod a form and unload current form? [email protected] Pro VB.NET 2002/2003 0 August 11th, 2006 09:15 AM
print current record in a form mjuliao Access 1 November 15th, 2005 08:57 AM
How to get info on Website form Win Application?! Awsok VS.NET 2002/2003 0 March 3rd, 2005 11:31 AM
Load another project's win form from current proj hplim18 VB.NET 2 April 1st, 2004 01:02 AM





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