Yuvraj Jambhle

Yuvraj Jambhle

  • NA
  • 93
  • 8.6k

Write static name text file at a dynamic location

Jul 16 2021 5:29 AM

Hello Friends,

I have written data in a text file at a fixed location. But I want to know how to define dynamic location. The filename should be declared in the textbox earlier. Filename defines in form using a text field. Same thing I had written in the below code. 

I want to know only how to define a dynamic location, don't want a static location.

private static StreamWriter WriteData;

 WriteData = new StreamWriter(@"C:\Users\user\Desktop\ReportTmplate\" + txtTemplateName.Text+ ".txt");                         WriteData.WriteLine(txtHeaderName.Text );
WriteData.WriteLine(txtEquipmentName.Text);


Answers (2)