Skip to content

Commit a6c8b58

Browse files
Fixed the file storage and retrieval. Will shift to a generic file location in next commit and add an option to change the deafult file path.
1 parent 911617a commit a6c8b58

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

TestProject/MyForm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ namespace TestProject {
119119
this->panel1->Name = L"panel1";
120120
this->panel1->Size = System::Drawing::Size(154, 431);
121121
this->panel1->TabIndex = 0;
122+
//this->panel1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &MyForm::panel1_Paint);
122123
//
123124
// sidePanel
124125
//

TestProject/MyUserControl.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ namespace TestProject {
8484
this->Controls->Add(this->label4);
8585
this->Name = L"MyUserControl";
8686
this->Size = System::Drawing::Size(510, 266);
87+
this->Load += gcnew System::EventHandler(this, &MyUserControl::MyUserControl_Load);
8788
this->ResumeLayout(false);
8889
this->PerformLayout();
8990

@@ -104,14 +105,14 @@ namespace TestProject {
104105
{
105106
StreamReader^ din = File::OpenText(finalPath);
106107

107-
String^ str;
108+
/*String^ str;
108109
int count = 0;
109110
while ((str = din->ReadLine()) != nullptr)
110111
{
111112
count++;
112113
datafromfile = datafromfile + str;
113-
}
114-
label4->Text = datafromfile;
114+
}*/
115+
label4->Text = din->ReadToEnd();
115116
}
116117
catch (Exception^ e)
117118
{
@@ -121,5 +122,8 @@ namespace TestProject {
121122
label4->Text = "problem reading file ";
122123
}
123124
}
124-
};
125+
private: System::Void MyUserControl_Load(System::Object^ sender, System::EventArgs^ e) {
126+
refreshdata();
127+
}
128+
};
125129
}

TestProject/MyUserControl1.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,14 @@ private: System::Void button3_Click(System::Object^ sender, System::EventArgs^
208208

209209
String^ title = textBox2->Text->ToString();
210210
String^ description = textBox1->Text->ToString();
211-
String^ data = "Title:\r\n" + title + "\r\nDescription:\r\n" + description;
211+
String^ data1 = "Title:\r\n" + title;
212+
String^ data2 = "Description:\r\n" + description;
212213
String^ nameOfFile = dateTimePicker1->Value.ToString("ddMMyyyy");
213214
String^ pathToFile = "e:\\TestLocation\\";
214215
String^ finalPath = pathToFile + nameOfFile + ".txt";
215216
StreamWriter^ pwriter = gcnew StreamWriter(finalPath);
216-
pwriter->WriteLine(data);
217+
pwriter->WriteLine(data1);
218+
pwriter->WriteLine(data2);
217219
pwriter->Close();
218220
textBox1->Clear();
219221
textBox2->Clear();

0 commit comments

Comments
 (0)