[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Dim x as Form

Posted on 2001-06-28
5
Medium Priority
?
623 Views
Last Modified: 2012-05-07
I'm new to objects...
I want to dynamically create a form.

If I try:
Dim x as Form
Set x = New Form1
With x
.show
.visible = true
end with

This will only work if I have an existing (Form1) in the .vbp. Can I create a form with events and add a textbox or 2, from scratch?
0
Comment
Question by:Object_shun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 6235004
the closest youll get is to just add a blank form to your project...you can call it frmTemplate or whatever you wish.  once it is added, you can then dynamically add controls to it.  this is my recommendation.

to truly create a blank "form" would require the use of the CreateWindow API, and creating your form window, and then writing all the necessary code, via API and CreateWindow also, to dynamically load your controls.  event handling would need to be done through the window procedure installed for the newly created window.  more ugly APIs...
0
 
LVL 32

Expert Comment

by:Brendt Hess
ID: 6235017
Unfortunately, no.

However, what you can do is create a 'Scratch' form, containing a single instance of each control type that you need, and use this scratch form as the basis for your dynamic forms.
0
 
LVL 1

Accepted Solution

by:
HelixDaKat earned 200 total points
ID: 6235064
You can create a form with API in VB.

Here is a link to some code that does it:
http://www.vbthunder.com/source/series/apictls3.htm

HelixDaKat
0
 

Author Comment

by:Object_shun
ID: 6235079
Azra...
So, let me see if I understand.
If I use CreateWindow API...it is possible to create the form? (without an existing Form1)
I'd be willing to try...as the "dynamic form" will only contain 1 label, to display a message, pause, and then unload.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6235160
you are creating a true "window", not really a form object as we know it in VB.  but yes, if thats all you are after then you should be able to.  here is a sample:
http://www.shrinkwrapvb.com/createw.htm
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question