• 0

vb6 copying form


Question

10 answers to this question

Recommended Posts

  • 0
  notsobetter said:
I've created a form with a certain amount of buttons using a specific layout.

I want to use the same button and form layout to make multiple forms.

Is there a way to make a copy of an existing form?

use yoru cursor and copy and paste.

:yes:

Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1672570
Share on other sites

  • 0

As for creating a custom control open VB and select a NEW "ActiveX Control" Place you control and code on the "form" (it's really just a placeholder for your controls and code, but I digress....)

Once this is created you do NOT have to compile the control as a DLL/OCX - a precompiled ActiveX control can be added to any project (so long as the code is available of course) Then you just drag and drop the control from the ToolBox onto whatever form you want to create.

However, there is another way... depending on why you want 20 (almost?) duplicate forms within your application.

Create a default new project, on Form1 create a button and add this code. It will create a new form each time you press the button. Hope this helps. Contact me if you have other questions.

Peace,

James

Private Sub Command1_Click()

Dim objForm As Form1

On Error GoTo ProcError

Set objForm = New Form1

With objForm

.Caption = Now()

.Show

End With

ProcExit:

On Error Resume Next

Exit Sub

ProcError:

MsgBox Err.Number & " " & Err.Description

End Sub

Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1674982
Share on other sites

  • 0

No, create a custom control which contains the layout of the project.. then add all 20 controls to the project and show them as needed.

notsobetter, seems like you know next to nothing about programming. I suggest you pick up a book before asking others to do whatever it is you want for you. Creating custom forms is part of the fundamentals of VB. I do believe I learned to do this in my first semester. I'm not trying to be a jerk but why would you request help when you can't be bothered to find out for yourself?

Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1675734
Share on other sites

  • 0

If you need 20 forms which all have the same fields (or even mostly the same fields) wouldn't it make more sense to use one form and reuse it? Otherwise I would suspect that there is something wrong with your design!

Otherwise if your design is sound and you have a really solid reason for doing this, make a single copy of the form e.g. Form1, save it, exit VB and then copy the form1.frm file repeatedly into form2.frm ... form20.frm. Open each form file and update the following elements:

Begin VB.Form Form1

Caption = "Form1"

LinkTopic = "Form1"

Attribute VB_Name = "Form1"

Then edit the project *.vbp file and add the forms there e.g. add the forms as:

Form=Form2.frm

...

Form=Form20.frm

But something smells wrong that you need 20 copies of exactly or roughly the same form, your asking for bloat and a maintenance nightmare!

Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1675966
Share on other sites

  • 0
  Quote
why would you request help when you can't be bothered to find out for yourself?

FU idiot

Isn't this what this forum is for? To find out information? And if you bothered to read what I had asked...

  Quote
Where can I find how to make a custom control

Then maybe you could have given me a valid answer instead of some generic bs. Idiot

Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1683008
Share on other sites

  • 0
  Quote
But something smells wrong that you need 20 copies of exactly or roughly the same form, your asking for bloat and a maintenance nightmare!

Yea, your right on that account. I'm just now learning it and trying new stuff. It isn't of importance other than to learn how to do something. Thanks for the input everyone. (except gadean. Your still an idiot.)

Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1683088
Share on other sites

  • 0
  Quote
Yea, you're right on that account. I'm just now learning it and trying new stuff. It isn't of importance other than to learn how to do something. Thanks for the input, everyone. (except gadean. You're still an idiot.)

Wait, I'm an idiot because you cannot figure out how to use a help file? Your needless flame was harshly inappropriate because my "generic" answer was intended to head you in the right direction. (*hint* go to www.google.com and type something like "VB 6 custom control example")

Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1685506
Share on other sites

  • 0
  Quote
I suggest you pick up a book before asking others to do whatever it is you want for you. Creating custom forms is part of the fundamentals of VB. I do believe I learned to do this in my first semester

Yea, like that wasn't filled with venom.

Let me break it down for you.

This......is.....a....forum.....

It's.....a.....programming.....forum.......

You......ask......questions......

........about programming.......

in....a.....programming....forum......

I do believe I learned to do this in my first post to a forum. Idiot

I thanked the people that helped me. Get off my back. Idiot

Edited by notsobetter
Link to comment
https://www.neowin.net/forum/topic/136939-vb6-copying-form/#findComment-1687636
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.