How Do I create Windows Form file in VS and add the form to my VS project?

C#, How Do I create Windows Form file in VS and add the form file to my VS project by using C# code?
I like to create a Windows Form file into my VS Win Form project by using C#. I have the path and the file name.
I need a Win Form with FileName.cs, FileName.Designer.cs, FileName.resx, and FileName (as you see it VS by adding a Win Form manually by using VS)
Rune Brattas

You cannot create a Form from code at run time. 
For one thing, the user running your application will, almost certainly, not have  a copy of Visual Studio to hand with which to build anything.  (Not that you actually need 'Studio at all; Notepad and csc.exe are all you actually
need), but that's another story).
You can do this with an awful lot of pain, using the innards of the compiler from iside your own program, compiling the new Form's source code on the fly and then executing the resulting assembly within your application.  IMHO, that's a simply terrifying
prospect especially as the code you will be compiling will be on someone else's machine and over which you will have absolutely no control.  If you're lucky, they'll spell something wrong and it won't compile.
The "usual" way to do this sort of thing is to create additional, "plug-in" forms as library assemblies and have your program load and execute these at run-time. 
Regards, Phill W.

Similar Messages

  • Create a text file in KM and add the structure of a node

    Hello Everybody,
    could some one please advise on how do I write the data stored in my node (elements) as string into a text file? How can i create a text file and add the structure of my node to it? I can just walk through my node recursively.
    Any help would be highly appreciated.
    Thanks in advance.
    Regards,
    Seed

    Are you referring to a org.w3c.dom.Node?
    In that case, the simplest approach would be to use KM's XML serializer (http://help.sap.com/javadocs/NW04s/current/km/com/sapportals/wcm/util/xml/SimpleSerializer.html)
    BR, Julian

  • How do you create a jar file with txt and classes?

    Hey, I'm trying to create code to create a jar file with a text file, but I can't figure out how to add the text file. Here is what I have so far:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
            }It creates the .jar file with the correct manifest but I can't get it to write the test.txt or anything else into the jar file.
    -Gandolf
    Edited by: GanMatt on Jun 18, 2009 8:18 AM
    Edited by: GanMatt on Jun 18, 2009 8:19 AM

    Alright, my question has changed. Here's the code:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.write("Hi".getBytes());
                out.flush();
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this,ex.toString(),"BUG!",JOptionPane.INFORMATION_MESSAGE);
            }It creates the jar file with the txt file inside it, but I can't write "Hi" inside of the text file. Any ideas?
    -Gandolf

  • How can one edit a .gif file graphics background and change the fonts in Photoshop Elements 13?

    I am trying to change the color and fonts of some of my web sites .gif files. Can I change the color to another hexadecimal color and change the fonts of the letters in Photoshop 13? I am using Windows 7 and heard that you could save the .gif file to another format, edit it, then change the file back to a .gif file. Is this true? If so, how do you do it? The file just has a solid color with the letters "Firm " on it. No animation.

    You can edit a gif without changing the format, but once you save the file as a gif the text becomes part of the image, not text anymore, so you would need to clone or heal away the existing text and then create a new text layer and use save for web to create a new gif.
    For access to the most editing tools, while the file is open in the editor go to image>mode and change it from index color to RGB. Saving as a gif will change it back to index mode.

  • How ca we create an INVOICE using a BAPI and triggring the same IDoc

    Hi Gurus,
    I have a senario where in I need to create an Invoice from a remote using BAPI and then the INVOICE IDOC has to be triggered for external purpose.
    How can be this achived??
    Help me as early as possible.
    Thanks in Advance...
    Suma

    Hi,
    Are you looking for BAPI <b>BAPI_ACC_INVOICE_RECEIPT_POST</b>?
    Hope this helps (please reward me if it does).
    Regards, Joerg

  • How Can I create a new event in Iphone and add invitees

    I have created events in iCal and add invitees, I could not found the way to do the same in Mobileme nor my Iphone,Is there a way to invite someone to a meeting in the Iphone?

    I was really frustrated by this change in Lion as I prefer to use the month view and I hate the way it defaults to an all day event.  So I was very pleased to find this solution in the Mac OS X Hints.  Simply type "Dinner at 6 pm" and it enters "Dinner" at 6 pm for one hour.  If you want anything other than an hour, put "6 - 8 pm" (or whatever period you want.  Brilliant.  Just wish Apple figured out a way to tell me that without having to search the communities here for an answer.
    Thanks Ferd II.

  • Linking Student Assessment Form (Rubric) to ePortfolio and Locking the Form when Completed

    Hello, I am attempting to move closer towards the paperless classroom using the Adobe Suite. I have created a student assessment rubric using a form that automatically calculates self assessment and teacher assessment scores and gives me updated responses etc. The next step is for the students to save this to their ePortfolio, however, I would like to be able to lock down the form before this step (eg after I have completed my assessment) so students cannot change either their own or my scores and comments. Apart from saving the doc as a jpeg, i can't quite work this out.*

    You can either flatten the pages of the document or lock the document by applying a digital signature and choosing to disallow changes. The other option of simply setting the fields to read-only is not secure and can be defeated relatively easily, so it wouldn't be the best option for this.
    For a handy JavaScript-based utility for flattening pages, see: http://www.uvsar.com/projects/acrobat/flattener/
    For more information on creating a certified document, see Acrobat's help doc.

  • How can I create an Excel file?

    Hi,
    How can I create an Excel file using Forms 6i.
    What I'm doing is to create a file using TEXT_IO package an name it .XLS. If a read it double-clicking over the file, it opens Ok but If I open directly from Excel it opens the Convert dialog.
    I need to create an excel file as it was made from within Excel.
    Thank in advance,
    Benjamin

    When you are talking about subfiles, are you talking like Package contents of an application?
    Terminal application in Applications -> Utilities can give a command line grasp of all your files using the du command.
    Type
    man du
    when entering the terminal, followed by the enter key.
    Note, by default the terminal opens at the Home folder.   To navigate outside the Home folder enter "/Volumes/name of mounted drive/folder/subfolder" as your path.  If there are spaces in the name, putting quotes around the whole path can help.    If you end your du command with a > name.txt a text file with the name name.txt will be plugged into your Home directory.  That you can open with Excel and parse by /es thus giving you everything in Excel.

  • How do i create one source file that feeds two users on the same pro book?

    how do i create one source file/folder of photos that feeds two users on the same pro book?

    Well you can do exactly the same with a folder of photos, just put in the Users/Shared folder.
    Iphoto is a mite more complex than this. It's a database and so there's a bit more involved.
    For iPhoto 09 (version 8.0.2) and later:
    What you mean by 'share'.
    If you want the other user to be able to see the pics, but not add to, change or alter your library, then enable Sharing in your iPhoto (Preferences -> Sharing), leave iPhoto running and use Fast User Switching to open the other account. In that account, enable 'Look For Shared Libraries'. Your Library will appear in the other source pane.
    Any user can drag a pic from the Shared Library to their own in the iPhoto Window.
    Remember iPhoto must be running in both accounts for this to work.
    If you want the other user to have the same access to the library as you: to be able to add, edit, organise, keyword etc.
    Quit iPhoto in both accounts. Move the Library to the Users / Shared Folder
    (You can also use an external HD set to ignore permissions, a Disk Image or even partition your Hard Disk.)
    In each account in turn: Double click on the Library to open it. (You may be asked to repair the Library Permissions.) From that point on, this will be the default library location. Both accounts will have full access to the library, in fact, both accounts will 'own' it.
    However, there is a catch with this system and it is a significant one. iPhoto is not a multi-user app., it does not have the code to negotiate two users simultaneously writing to the database, and trying will cause db corruption. So only one user at a time, and back up, back up back up.

  • How I can create a XML file from java Aplication

    How I can create a XML file from java Aplication
    whith have a the following structure
    <users>
    <user>
    <login>anyName</login>     
    <password>xxxx</password>
    </user>
    </users>
    the password label must be encripted
    accept any suggestion

    Let us assume you have all the data from the jsp form in an java bean object..
    Now you want a xml file. This can be acheived in 2 ways
    1. Write it into a file using java.io classes. Say you have a class with name
    write("<name>"+obj.getName+</name>);
    bingo you have a flat file with the xml
    2. Use data binding to do the trick
    will recommend JiBx and Castor for the 2nd option
    Regards,
    Rajagopal

  • How do you create a jar file in JDeveloper 11.1.2.0.0

    How do you create a jar file in JDeveloper 11.1.2.0.0

    1) Select the project for which you would like to generate the jar.
    2) Right Click the selected right and select 'Project Properties'
    3) Select the 'Deployment' in the left tab.
    4) Click on 'New' to create a new deployment profile and in the popup dialog, select 'Jar File' profile type and provide the name.
    5) Press 'ok' to save the changes.
    6) Select the project and right click and select 'Deploy to' and select the jar profile name you have specified.
    The Jar library is generated and the full path to the library jar is shown in the log window.
    Thanks,
    Navaneeth

  • How do I create a ".URL" file from a webpage I'm viewing

    How do I create a ".URL" file from a webpage I'm viewing

    The simplest way is to drag the "site identity button" (the padlock, for secure pages, and the globe, for other pages) to the desktop and drop it there. You may need to resize various window in order to be able to see the desktop while also viewing the site.
    There is an add-on for sending a shortcut to Windows without having to use this method. I haven't tried it myself:
    * Page on Add-ons site: https://addons.mozilla.org/firefox/addon/deskcut/
    * Review describing an extra setup step if it's not working: https://addons.mozilla.org/firefox/addon/deskcut/reviews/490684/

  • How can I create a GIF file ?

    Does anybody know, how can I create a Gif file with LV.
    I had used the print option (Print to HTML file) from LV but I can't use it
    when I
    create an application with appbuilder.
    Does anybody know another way to carry it out?
    Thanks in advance

    You understood me correctly but the properties of the documentation tool
    doesnt exist
    after building the application (Runtime Version). Only the Menu "File /
    Print Window" option is present. Therefor I looked for another way to do it.
    "Dennis Knutson" schrieb im Newsbeitrag
    news:506500000005000000A24C0000-1004225886000@exch​ange.ni.com...
    > I was talking about the properties of the documentation tool which
    > creates an html file and allows for the selection of GIF as an image
    > format. The GIF files are the front panel, diagram, and icon. You
    > didn't specify what you are trying to print but if you need something
    > else, let us know.

  • How do I hide Windows .ini files in a dock folder?

    Background: On my MacBook Pro, I divided my hard drive into 3 partitions - one for Mac OS X, one for Windows 7, and one for common storage that I use to transfer my files between OS's.
    With this setup, I set my Dropbox folder on the "common storage" partition, and created a Dropbox dock folder for easy access. This isn't really a major problem, but it simply annoys me. Since Windows also has access to the Dropbox folder, it creates a desktop.ini file that shows up whenever I use the Dropbox dock shortcut. I tried editing it through Finder, but it's already hidden. It only shows up in the dock folder.
    Is there a way to hide this .ini file?

    What do you mean deleted from the user's list?  Do you mean removed permissions?  If so, right click the folder and select get info.  Scroll down to sharing and permissions.  Click the lock and put in your password.  Then click the + and add the user back.
    Otherwise, more details...

  • How can I Create a exe file were a tab control on it work`s

    I have a VI with many controls and indicators,these are spread on a tab control.This tab control works with out any problems but if i create a exe file then the tab control is fixed. How can I create a exe file so that the tab control on it work´s ?"
    Attachments:
    project7.1.jpg ‏129 KB

    Make the tab control a control and not an indicator. If you want to write
    to it you need to create a local variable.
    "Carlos-R." wrote in message
    news:[email protected]..
    I have a VI with many controls and indicators,these are spread on a
    tab control.This tab control works with out any problems but if i
    create a exe file then the tab control is fixed. How can I create a
    exe file so that the tab control on it work´s ?"

Maybe you are looking for

  • MediaSource 5 isn't recognizing my Zen Xtra pla

    Hi, I have a Nomad Jukebox Zen Xtra mp3 player, version .03.02. I've had it since July of 2003. I recently bought a new computer (Dell Inspiron 520; Windows XP Home Edition). My old computer had Creative Organizer software on it. I no longer have (or

  • Strange Problem in HTML DB 2.0 version-

    I am creating one application which consists of 2 tab pages. At end of 2nd tab page, i will make a insert statement to insert data in database. Now, when i enter data in first tab page and go to next tab page, data from first page disappears. But on

  • Finder Preview image size

    Is there any way to get a larger Finder Preview image size? ( I've already got the column view very wide )

  • Is it possible to create a control file without the datafiles

    Hi All, Is it possible to create a control file without the datafiles? on any OS or DB version regards, sachin

  • Problem with new Notifications on Mountain Lion

    The new 'notifications' on Mountain Lion are appearing on the top right of one of my MacBooks and staying there until manually closed whereas on the other they disappear after a few seconds. I can not figure out why. Does anyone know?