Avatar billede maagefinke Nybegynder
19. december 2003 - 21:29 Der er 7 kommentarer og
1 løsning

Kalde form1 i project2 fra form1 i procect1

Når jeg er i project1 kan jeg få vist en form fx således: form2.show 1
men hvordan kalder jeg
form1 i project2 fra form1 i project1.
Og hvordan kommer jeg retur igen.

Hvad er koden for disse kald, please?
Avatar billede joern Nybegynder
19. december 2003 - 23:34 #1
Hej.

Når dine projekter er kompileret til exe.filer er de programmer som alle andre.
Fra et VB-program kan du anvende shell til at kalde andre exe-filer.  Når det kaldte program afsluttes, vil focus returnere til det de oprindeligt anvendte.

  x= shell("c:\windows\notepad.exe minfil.txt")


Hvis data skal overføres mellem to programmer, må de skrives til filer.

M.v.h.  Jørn
Avatar billede maagefinke Nybegynder
19. december 2003 - 23:46 #2
Jeg har nok udtrykt mig dårligt. Jeg har oprettet et projekt2 i projekt1 fordi jeg har en hel masse "underforme" til en form og gerne vil holde dem samlet, men dog således at jeg kan kalde dem fra form1 i projekt1.
Har jeg misforstået alt?
Avatar billede joern Nybegynder
20. december 2003 - 08:15 #3
Hej.

Jeg har aldrig forsøgt, det du beskriver og vidste ikke, at det kunne lade sig gøre.  Så jeg kan ikke hjælpe i dette spørgsmål.

M.v.h.  Jørn
Avatar billede martin_moth Mester
20. december 2003 - 11:23 #4
Øhh- det kan man da heller ikke? Jeg er lige så undrende som Jørn
Avatar billede maagefinke Nybegynder
20. december 2003 - 11:32 #5
Når jeg står i project 1 klikker jeg på File og herefter på add project. I project 1 dukker herefter project 2 op sammen med form1 i project2. Jeg troede så at det var muligt at kalde dette project lige som fx form2.show 1. Men bare noget i retning af:project2.form1.show, men så får jeg at vide, at der mangler et object.
Avatar billede joern Nybegynder
20. december 2003 - 12:23 #6
hej maagefinke.

Mon så ikke project2 bliver en del af project1 ?  Man kan jo sagtens importere forme fra ét projekt til et andet, men der må så ikke være 2 forme med samme navn - måske filnavn så længe de ligger i hver sin mappe, men ikke form-navne i projektet.
Kunne du ikke nøjes med at importere formene? Og bevare at det er ét projekt.
Du kan vel nok navngive dine forme således at du bevarer overblikket alligevel.

M.v.h.  Jørn
Avatar billede joern Nybegynder
20. december 2003 - 12:26 #7
Hej igen.

Jeg har lige kigget i VB Books Online, der står noget om projekt-grupper.  har du selv Books Online installeret, ellers findes den på din setup CD.

You can create many applications by working with a single project. However, as your applications become more complex, you may want to work with multiple projects in the same session of the programming environment. For example, you may want to use one project to build an application's executable file, and a second project to serve as a "scratch pad" for testing code before you add it to the application.
You can add a new or existing project to your current editing session by adding it to a project group. You can then save the project group and work with it in subsequent editing sessions. You can open either the project group or an individual project in the project group, or add the project group or its individual projects to another project group.
In a project group, one executable project serves as a startup project. When a project group is open and you choose Start from the Run menu, click the Start button on the toolbar, or press F5, Visual Basic runs the startup project.
In the Profession or Enterprise edition, you can use project groups to create and debug multiple-component applications. For example, you can create and debug project groups containing standard executable projects, ActiveX executable projects, ActiveX dynamic-link library projects, or ActiveX control projects. For more information, see "Creating ActiveX Components" in the Component Tools Guide included with the Professional and Enterprise Editions of Visual Basic.
Adding or Removing a Project
When you create a new project either at startup or by selecting the New Project command on the File menu, Visual Basic automatically creates a project group for it. You can then add additional new or existing projects to the project group.
    To add a new project to a project group
·    Click the Add Project button on the Toolbar or choose Add Project from the File menu.
In Visual Basic, Learning edition, Visual Basic automatically adds a new executable project to the project group. In the Professional and Enterprise editions, you can select the type of project you want to add from the popup menu of the Add Project button, or the icons displayed in the New tab of the Add Project dialog box.

    To add an existing project to a project group
1    From the File menu, choose Add Project.
Visual Basic displays the Add Project dialog box.
2    Click the Existing tab.
3    Select a project file, then choose Open.
Visual Basic adds the selected project to the project group.

Visual Basic displays multiple projects in the Project window in a hierarchical view. Each project appears at the top level, with the project's forms, modules, controls, property pages, or document objects grouped under it in the hierarchical view.
Figure 8.1  The Project window with multiple projects

   
    To remove a project from a project group
1    Select the name of the project in the Project window.
2    From the File menu, choose Remove Project.
Visual Basic removes the selected project from the project group.

In the Professional and Enterprise editions of Visual Basic, you can change the type of a project by selecting the Project Properties command on the Project menu, then changing the Project Type option on the General tab in the Project Properties dialog box.
Figure 8.2  The General tab in the Project Properties dialog box

   
Specifying a Startup Project
Because a project group contains multiple projects, Visual Basic needs to know which project to run when you choose Start from the Run menu, click the Start button on the toolbar, or press F5. By default, Visual Basic runs the first executable (.exe) project that is added to a project group. However, you can specify a different startup component.
    To specify a startup component
1    In the Project window, select a project.
2    Click the right mouse button and select Set as Start Up from the context menu.

Visual Basic displays the startup project's name in bold type in the Project window.
For More Information  Debugging multiple projects is discussed in "Debugging, Testing, and Deploying Components," in "Creating ActiveX Components" in the Component Tools Guide included with the Professional and Enterprise editions of Visual Basic.


M.v.h.  Jørn
Avatar billede maagefinke Nybegynder
20. december 2003 - 14:15 #8
Jo, jeg KAN godt styre det, men det så bare så enkelt og funktionelt ud med et nyt projekt i projektet.
Du skal have mange tak for hjælpen.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester