Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:53:34+00:00 2026-05-26T17:53:34+00:00

I am using visual c++ 2005 .net and I am looking to create a

  • 0

I am using visual c++ 2005 .net and I am looking to create a file from this form. I want to be able to name the file by entering what ever is in the text box. Any help would be greatly appreciated.

Here is the form:

enter image description here

this is what I have so far:

  private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

        String^ path = "C:\\" ".txt" ;

        StreamWriter^ sw = File::CreateText( path );

        try
          {
             sw->WriteLine("");

          }
          finally
          {
             if ( sw )
                      delete (IDisposable^)sw;
          }

                 }
        };

FIXED CODE:

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {               

     NewPart ^newpart = gcnew NewPart();
                     newpart->ShowDialog();
                     this->Close();

                    String^ fileName = textBox1->Text;
                    String^ filetype = ".xml";
                    String^ path = L"C:\\;

                     String^ fullName = path + fileName + filetype;

                    StreamWriter^ sw = File::CreateText(fullName);

        try
          {
             sw->WriteLine("<?xml version= \"1.0\" standalone=\"yes\"?>");
             sw->WriteLine("<macdata");
             sw->WriteLine("</macdata>");

          }
          finally
          {
             if ( sw )
                      delete (IDisposable^)sw;
          }

                 }


        };
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:53:34+00:00Added an answer on May 26, 2026 at 5:53 pm
    String^ path = textBox1->Text;
    

    Replace textBox1 with actual TextBox name from your form.

    Edit. Regarding your second question, look at this code:

    int main(array ^args)
    {
        String^ fileName = L"file.txt";
        String^ path = L"C:\\";
    
        String^ fullName = path + fileName;
    
        Console::WriteLine(fullName);
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a standalone application in VB.NET using Visual Studio 2005. I want to
I am using Visual Studio 2005, (.NET version > 2.0+) to create a windows
(Using Visual Studio 2005 / .NET 2.0) I have a DataSet which is being
I'm using Visual Studio 2005 with VB.NET. I have a number of Crystal Reports,
Using Visual Studio .NET 2008 or 2005, is there a way to automatically generate
I have CruiseControl.net running Visual Studio (2005/2008 - using devenv.com) as we need to
I am new to visual studio/asp.net so please bear with me. Using vs 2005
I am using Visual Studio 2005, Sql Server 2005, C#, ADO.NET. We have a
While developing and ASP.NET application in C# or VB using Visual Studio 2005/2008/2010 (Not
I am trying to create an ASP .NET Web Service Application using Visual Studio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.