Results 1 to 19 of 19

Thread: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new name VS2022

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Resolved [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new name VS2022

    The form already has all the controls, colors and layout I need.
    I have it as frmInsert008.vb in my vs2022 project.

    I tried renaming to frmInsert006.vb but none of the form designer is there, just an empty looking form
    The code does appear though.

    If I can do that it will save a lot of time over recreating from scratch a new form to become frmInsert006

    I also tried all 3 of the form extensions to be added, including the .vb, .resx.designer.vb and still no go.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    I did see I can create a new form. And from the old form edit select all and paste everything into the new form.

    The form background color is not the same, is that the only difference?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,100

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    Just use drag and drop. In the Solution Explorer, Ctrl+drag and drop your form, just as you would if you wanted to duplicate a file in File Explorer.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,082

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    Just curious, but why do you need 2 identical Forms?
    You can use instances of the same form, but for different tasks…
    Last edited by .paul.; May 25th, 2024 at 06:19 PM.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    Quote Originally Posted by .paul. View Post
    Just curious, but why do you need 2 identical Forms?
    You can use instances of the same form, but for different tasks…
    They won't be entirely identical.
    Basically, it is a form that constructs a structured MARC tag string of some 17 positions and displays a portion of a help file when a user goes to enter a character. I use RTB of mostly 1 char max for every position. Even the code is very similar but not the exact same,

    Years ago. I did this for tag 007 and 008, ignoring 006 which is an extension 008
    Without some structured help as a guide, no one could properly code the string.
    So I created a help file which I will split couple times so as when a user moves unto a rtb, the help for that position is displayed in a large rtb below.

    For myself reusing a form, I have never done, just easier to use another form.

    Made the help file from the LOC website

    https://www.loc.gov/marc/bibliograph...ise/bd006.html

    A small example of that help file. Will array split at the ----------------- and at the **

    Code:
    Library of Congress <https://www.loc.gov/> >> MARC <https://www.loc.gov/
    marc/> >> Bibliographic <https://www.loc.gov/marc/bibliographic/> >> 00X
    <https://www.loc.gov/marc/bibliographic/bd00x.html> >> *006*
    -------------------------------------------------------------------
    
    
      006 - Fixed-Length Data Elements-Additional Material Characteristics (R)
    
    -------------------------------------------------------------------
    MARC 21 Bibliographic - Concise
    2010
    -------------------------------------------------------------------
    
    Eighteen character positions (00-17) that provide for coding information
    about special aspects of the item being cataloged that cannot be coded
    in field 008 (Fixed-Length Data Elements). It is used in cases when an
    item has multiple characteristics (e.g., printed material with an
    accompanying cassette or a map that is issued serially) and to record
    the coded serial aspects of nontextual continuing resources.
    
    Field has a generic tree structure, whereby the code given in 006/00
    (Form of material) determines the data elements defined for subsequent
    character positions. Except for code s (Serial/Integrating resource),
    the codes in field 006/00 correspond to those in Leader/06 (Type of
    record). For each occurrence of field 006, the codes defined for
    character positions 01-17 will be the same as those defined in the
    corresponding field 008, character positions 18-34. Configurations of
    field 006 are given in the following order: books, computer files/
    electronic resources, maps, music, continuing resources, visual
    materials, and mixed materials.
    
    ------------------------------------------------------------------------
    
    *006--BOOKS*
    
    For descriptions of character positions 01-17, see the descriptions of
    corresponding character positions 18-34 in the 008--BOOKS <https://
    www.loc.gov/marc/bibliographic/concise/bd008b.html> section of Control
    Field 008.
    
    /Character Positions/
    
    **00 - Form of material *
    	a - Language material
    	t - Manuscript language material
    
    **01-04 - Illustrations *	See the description of positions 18-21 (Illustrations) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	18-21 - Illustrations (006/01-04)
            Up to four (4) one-character alphabetic codes (recorded in alphabetical order)that indicate the presence of types of illustrations in the item. If fewer than four   
            alphabetic codes are assigned, the codes are left justified and unused positions contain blanks (#).
    
    	# - No illustrations
    	a - Illustrations
    	b - Maps
    	c - Portraits
    	d - Charts
    	e - Plans
    	f - Plates
    	g - Music
    	h - Facsimiles
    	i - Coats of arms
    	j - Genealogical tables
    	k - Forms
    	l - Samples
    	m - Phonodisc, phonowire, etc.
    	o - Photographs
    	p - Illuminations
    	| - No attempt to code
    
    **05 - Target audience *	See the description of position 22 (Target audience) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	22 - Target audience (006/05)
            One-character alphabetic code that describes the intellectual level of the target audience for which the material is intended.
    
    	# - Unknown or not specified
    	a - Preschool
    	b - Primary
    	c - Pre-adolescent
    	d - Adolescent
    	e - Adult
    	f - Specialized
    	g - General
    	j - Juvenile
    	| - No attempt to code
    
    **06 - Form of item *	See the description of position 23 (Form of item) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	23 - Form of item (006/06)
            One-character alphabetic code that specifies the form of material for the item.
    
    	# - None of the following
    	a - Microfilm
    	b - Microfiche
    	c - Microopaque
    	d - Large print
    	f - Braille
    	o - Online
    	q - Direct electronic
    	r - Regular print reproduction
    	Eye-readable print, such as a photocopy.
    	s - Electronic
    	| - No attempt to code
    
    **07-10 - Nature of contents *	See the description of positions 24-27 (Nature of contents) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	24-27 - Nature of contents (006/07-10)
            Up to four one-character codes that indicate whether a significant part of the item is or contains certain types of material. If fewer than four codes are assigned, the  
            codes are left justified and unused positions contain blanks (#).
    
    	# - No specified nature of contents
    	a - Abstracts/summaries, Abstracts or summaries of other publications. Not used when a publication includes an abstract or summary of its own content.
    	b - Bibliographies
    	c - Catalogs
    	    Also includes lists of collectible objects, such as stamps and coins, or trade catalogs, etc. For catalogs of books, sound recordings, or motion pictures, code b       
                (Bibliographies), code k (Discographies), or code q (Filmographies), are given with code c.
    
    	d - Dictionaries
    	e - Encyclopedias
    	f - Handbooks
    	g - Legal articles
    	i - Indexes
                Index to bibliographical material other than itself.
    
    	j - Patent document
    	k - Discographies
    	l - Legislation
    	    Full or partial texts of enactments of legislative bodies, published either in statute or in code form, or texts of rules and regulations issued by executive or            	    administrative agencies.
    
    	m - Theses
    	    Thesis, dissertation, or work identified as having been created to satisfy the requirements for an academic certification or degree.
    
    	n - Surveys of literature in a subject area
    	    Composed entirely of authored surveys that summarize what has been published about a subject.
    
    	o - Reviews
    	    Devoted entirely to critical reviews of published or performed works (e.g., books, films, sound recordings, theater).
    
    	p - Programmed texts
    	q - Filmographies
    	r - Directories
    	s - Statistics
    	t - Technical reports
    	u - Standards/specifications
    	v - Legal cases and case notes
    	w - Law reports and digests
    	y - Yearbooks
    	z - Treaties
    	    Treaty or accord negotiated between two or more parties to settle a disagreement, establish a relationship, grant rights, etc.
    
    	2 - Offprints
    	    Publication that originally was published as an article in a monograph or a serial and that is also issued separately and independently. Includes preprints and          	    postprints.
    
    	5 - Calendars
    	6 - Comics/graphic novels
    	| - No attempt to code
    
    **11 - Government publication *	See the description of position 28 (Government publication) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	28 - Government publication (006/11)
    	One-character code that indicates whether or not the item is published or produced by or for an international, national, state, provincial, or local government     
            agency, or by any subdivision of such a body.
    
    	# - Not a government publication
    	a - Autonomous or semi-autonomous component
    	c - Multilocal
    	f - Federal/national
    	i - International intergovernmental
    	l - Local
    	m - Multistate
    	o - Government publication-level undetermined
    	s - State, provincial, territorial, dependent, etc.
    	u - Unknown if item is government publication
    	z - Other
    	| - No attempt to code
    
    **12 - Conference publication *	See the description of position 29 (Conference publication) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	29 - Conference publication (006/12) 
            one character code that indicates whether the item consists of the proceedings, reports, or summaries of a conference.
    
    	0 - Not a conference publication
    	1 - Conference publication
    	| - No attempt to code
    
    **13 - Festschrift *	See the description of position 30 (Festschrift) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	30 - Festschrift (006/13)
    	One-character code that indicates whether the item is a festschrift.
    
    	0 - Not a festschrift
    	1 - Festschrift
    	| - No attempt to code
    
    **14 - Index *	See the description of position 31 (Index) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	31 - Index (006/14)
    	One-character numeric code that indicates whether the item includes an index 	to its own contents.
    
    	0 - No index
    	1 - Index present
    	| - No attempt to code
    
    **15 - Undefined *	Contains a blank (#) or a fill (|) character
    	32 - Undefined (006/15)
    	Undefined; contains a blank (#) or a fill character (|).
    
    **16 - Literary form *	See the description of position 33 (Literary form) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	33 - Literary form (006/16)
            One-character code used to indicate the literary form of an item. Numeric codes 0 and 1 provide a generic identification of whether or not the item is a work of  
            fiction. Alphabetic codes may be used to identify specific literary forms.
    
            0 - Not fiction (not further specified)
            1 - Fiction (not further specified)
            d - Dramas
            e - Essays
            f - Novels
            h - Humor, satires, etc.
    	    Humorous work, satire, or of similar literary form.
    
            i - Letters
                Single letter or collection of correspondence.
    
            j - Short stories
                Short story or collection of short stories.
    
    	m - Mixed forms
         	    Represents a variety of literary forms (e.g., poetry and short stories).
    
            p - Poetry
            s - Speeches
            u - Unknown
            | - No attempt to code
    
    **17 - Biography *	See the description of position 34 (Biography) under /008--BOOKS <https://www.loc.gov/marc/bibliographic/concise/bd008b.html>/
    	34 - Biography (006/17)
            One-character alphabetic code that indicates whether or not an item contains biographical material, and if so, what the biographical characteristics are.
    
            # - No biographical material
            a - Autobiography
            b - Individual biography
            c - Collective biography
            d - Contains biographical information
            | - No attempt to code
    ------------------------------------------------------------------------
    
    *006--COMPUTER FILES/ELECTRONIC RESOURCES *
    
    For descriptions of character positions 01-17, see the descriptions of
    corresponding character positions 18-34 in the 008--COMPUTER FILES
    <https://www.loc.gov/marc/bibliographic/concise/bd008c.html> section of
    Control Field 008.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    Anyhow that files runs on and on with every position having defined information.

    You just end up with strings like these. Simply illustrative, not actual tag records you would see in a program

    https://www.loc.gov/marc/bibliograph...es.html#serial

    Something with actual pics looks like this.
    https://marcedit.reeset.net/howto-ed...irst-recordset
    Years ago I modeled my own program around Terry Reese's MARCEdit editor.

    And of course, it can be extended and get very complex into various forms.
    But MARC is just a way of transferring data into and out of library systems.
    That data has to be put to use inside a library program, that people can understandably use.

    Code:
    =LDR 01336cam  22003258a 4500
    =042  ##$apcc
    =050  00$aQD181.H4$bH37 2007
    =082  00$a546/.751$2HAS
    =100  1#$aHasan, Heather.
    =245  10$aHelium /$cHeather Hasan.
    =250  ##$a1st ed.
    =260  ##$aNew York :$bRosen Pub. Group,$c2007.
    =263  ##$a1111
    =300  ##$ap. cm.
    =440  #0$aUnderstanding the elements of the periodic table
    =504  ##$aIncludes bibliographical references and index.
    =505  0#$aIntroduction to helium -- The element helium -- The properties of   helium -- Collecting helium -- Helium and you.
    =650  #0$aHelium$vPopular works
    =650  #0$aPeriodic law$vPopular works.
    =856  41$3Table of contents only   $uhttp://www.loc.gov/catdir/toc/ecip061/2005029027.html
    =901  ##$a55843322566
    =903  ##$a{dollar}21.95hbk
    =905  ##$a21 days$b2
    =902  ##$a1106-08

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    So far nothing works trying to create another form from another form

    Last thing I just tried was select all controls and paste into a new form
    Then I pasted the code from the other form into the new form.
    Renamed new from and changed sub names.

    And totally stuck, none of the control names are recognized in the code window as pertaining to this new form

    Copy paste to make a copy in the project also did not work.

    I suppose I am doing it wrong. I read some googling and people are saying have to open some files in a text editor to make changes, can't use VS2022 IDE.
    Link to what I am seeing now in the code of the form, all those controls have those names in the form designer, but none are acknowledged at belonging to the form.

    https://photos.app.goo.gl/8MMw5LLu7kV21KNL6

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    image showing new form and the first RTB in the form with that name
    And in the code window, the control is not recognized.

    You can see in the prior post, that name for example _rtxt007_0, has red squiggly lines under it.
    It is however on the form designer as a RTB called that name.

    https://photos.app.goo.gl/n9hEPt8Vvnq79DEG7

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    Well, I just figured something out

    The line above this 'Friend Class frmInsert006' written as 'Public Class frmInsert006'
    had to be deleted, now the controls are recognized

  10. #10
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,856

    Re: Want to copy, duplicate a form and add as an existing item with a new name VS2022

    Quote Originally Posted by sdowney1 View Post
    Well, I just figured something out

    The line above this 'Friend Class frmInsert006' written as 'Public Class frmInsert006'
    had to be deleted, now the controls are recognized
    If you look in the folder where the project is, you will see that a form is made up of two files e.g. Form1.vb and Form1.Designer.vb - if you are duplicating a form you need to copy and update both of these files.

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,100

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    Or you could have just done what I said - Ctrl+drag and dropped the existing form - and then changed the type name in code. Note that, as mentioned above, the form code is in two partial classes in two separate code files, so you need to change the name in both. Using the Solution Explorer ensures that all the multiple files that constitute a form are copied.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    Drag it from where to where?
    It is all in the same IDE and in the program already.

    What I need to do is practice as I learn by doing.

    I got the code mostly done, and the frmInsert006 works.

    There is though a notable difference in control size when it runs, not in the designer, all the RTB are the same size as is the form, 006 and 007.
    When I run the frmInsert007, the form is bigger and the RTB too.

    When I run the frmInsert006, the entire form is smaller and the RTB too.

    How can this look the same size as the frmInsert007 I had copied?

    I thought, well I could manually enlarge the RTB, but I don't think I should have to do that.

    Check the size in properties, and they are the same between both forms.

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    I also notice vs2022 is showing a yellow notice about 125% scaling at top when frmInsert007 is opened?
    And I don't think it shows that when frmInsert006 is viewed?

    I can recheck that today, been busy with family stuff last few days.

  14. #14
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,100

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    Quote Originally Posted by sdowney1 View Post
    Drag it from where to where?
    I'm not sure why people want to abandon the logic that they've already used many times before. I specifically said:
    just as you would if you wanted to duplicate a file in File Explorer
    If you were duplicating a file in File Explorer, you would drag the file from its existing location and drop it on the same folder while depressing Ctrl. The same goes here. Your project and your form are both represented by nodes in a tree in the Solution Explorer. Drag the form onto the project and drop it while depressing Ctrl. Voila! That will duplicate all the files associated with the form and create new nodes for them. You can then open the user and designer code files to change the class name, then right-click the class name in one of those files and select the option to change the file name(s) to match. That will change the names of all related files. All up, you'd be dawdling if it took you 30 seconds.

    Just note that, in VB projects, the designer code file is not displayed in the Solution Explorer by default. You have to click the Show All Files button and then expand the form node to see the designer code file.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    Actually, in windows, while in the same folder as I want a copy, I just right click, copy, then paste.
    I don't do any dragging.
    in File Explorer, that creates a duplicate file with copy added to the name.

  16. #16
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,100

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    But that wouldn't be drag and drop then would it, and the first thing I said was to use drag and drop. Do you really not know how drag and drop works in Windows? What are you actually trying to achieve here? Do you want to be right? OK, you're right and I was wrong. Clearly, there's nothing you can learn from me so there's no point my providing any information to you about anything ever. Good on you.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    I still have no real idea about where your dragging the file from, from where to where.
    Are you talking of dragging it from windows file explorer opened up to where the file exists for the project, drag that into the IDE?
    If so, I can understand that as an explanation.

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    874

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    Maybe tomorrow will play with creating duplicate test forms using various methods to see how it can work.

    I did when I started this thread, I had clicked copy and paste and it created a copy of the form, with copy added into the name.
    But ran into some issue which can't recall at the moment.

    Actually, one error I recall, the designer refused to open to show the form, and said catastrophic error.
    I know hard to believe ha!
    Think I deleted permanently and redid the copy but then some other issue.
    Anyway I did get a copy working by copying the controls onto a new form.

    Most likely the issue is my own ignorance of making a form work in vs2022.

  19. #19
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,082

    Re: [RESOLVED] Want to copy, duplicate a form and add as an existing item with a new

    Drag the formname.vb from your project file explorer, to whitespace at the bottom of your project file explorer?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width