Hallo, Voor mijn stage moet ik een simpele tekst editor in elkaar zetten.
het enigste wat is tot nu toe kan is:
Kan iemand mij hier mee helpen
Dit is mijn code:

het enigste wat is tot nu toe kan is:
- Opslaan
- Laden
- Clearen
Kan iemand mij hier mee helpen
Dit is mijn code:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Novacode;
using System.Diagnostics;
using System.Drawing.FontStyle;
namespace Data_Verplaatsen_v1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
FormBorderStyle = FormBorderStyle.FixedDialog;
}
public void btn_save_Click(object sender, EventArgs e)
{
string pat = Convert.ToString(txt_zoeken.Text);
if (txt_zoeken.Text == "")
{
MessageBox.Show("Missing file name!", "File name ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (txt_zoeken.Text == pat)
{
int i;
pb_loading.Value = 0;
pb_loading.Maximum = 100;
for (i = 0; i <= 100; i++)
{
pb_loading.Value = i;
using (StreamWriter writer = new StreamWriter("C:\\Users\\ExitReizen\\Documents\\" + pat + ".doc"))
{
writer.Write(mtxt_schrijfen.Text);
}
}
}
}
private void btn_load_Click(object sender, EventArgs e)
{
pb_loading.Visible = true;
string pat = Convert.ToString(txt_zoeken.Text);
string sourcepath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string[] words = new string[3];
if (txt_zoeken.Text == "")
{
MessageBox.Show("Missing file name!", "File name ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (txt_zoeken.Text == pat)
{
int i;
pb_loading.Value = 0;
pb_loading.Maximum = 100;
for (i = 0; i <= 100; i++)
{
pb_loading.Value = i;
string loadd = File.ReadAllText("C:\\Users\\ExitReizen\\Documents\\" + pat +".doc");
mtxt_schrijfen.Text = (loadd);
}
}
}
private void btn_clear_Click(object sender, EventArgs e)
{
mtxt_schrijfen.Clear();
txt_zoeken.Clear();
}
private void Cboc_bold_CheckedChanged(object sender, EventArgs e)
{
if (Cboc_bold.Checked)
{
mtxt_schrijfen.Font.Bold = true;
}
}
}

Laatst bewerkt: