Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Visual basic express edition 2008 question.?

I'm making a code generator. The first form lets you check/uncheck certain items to fit your liking. I just can't figure out how to output the code. I thought about making a form with a large text box on it and put the code in there but I can't figure out how to load the form. How can I load the form or what's a better way to out put a bunch of code?

Update:

**** you ronna. You fat dumb *****. It's clearly leading me to a sight which asks to download a video codec. "Aka" virus.

Update 2:

Thank you. I got it now. I was also wondering though, how can I indent the code and space it out so it's not all on one line?

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    There's a couple of ways you can do it. You might want to place another check box that asks a user if they want to display the generated code in a pop up (New form) or save it to a file.

    To pop up a new form, create your new form with the big text box on it. Make sure you set scrollbars to true on the text box.

    Then from your main form, when you generate the code, simply do the following:

    dim f as new frmGeneratedCode

    'Now that you created the form, add the text of the generated code to the Text Box

    f.TextBox1.Text = generatedCode

    f.Show 'Or f.ShowDialog if you want to open the form modally (can't click away from it)

    From there, your user can then copy and paste the text as needed. You could even add a button to that form that will allow the user to save the file.

    To save the file, you can do this:

    Add a FileSaveDialog to your form you're saving from.

    After you've generated the code, do this.

    If FileSaveDialog1.ShowDialog = DialogResult.OK Then

    IO.File.WriteAllText(FileSaveDialog1.FileName, generatedCode) 'Will create a new file or overwrite an existing file and write all the text to that file

    End If

    You could do this from both forms easy enough. Good luck!

    Source(s): Programming Experience
Still have questions? Get your answers by asking now.