0
I’m creating a C#text editor, but when I saved a file .html
, on the page appeared this error
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace onedev
{
public partial class Form1 : Form
{
string language;
public Form1()
{
InitializeComponent();
}
private void hTMLToolStripMenuItem_Click(object sender, EventArgs e)
{
language = "HTML";
codding.Text += "<!DOCTYPE html><html> <head><title>Hello world</title></head> <body><h1>Hello World!</h1></body></html>";
}
private void htmlToolStripMenuItem1_Click(object sender, EventArgs e)
{
}
private void salvarToolStripMenuItem_Click(object sender, EventArgs e)
{
if (language == "HTML")
{
SaveFileDialog saveHtml = new SaveFileDialog();
saveHtml.DefaultExt = "*.html";
saveHtml.Filter = "HTML|*.html";
if (saveHtml.ShowDialog() == System.Windows.Forms.DialogResult.OK &&
saveHtml.FileName.Length > 0)
{
codding.SaveFile(saveHtml.FileName);
}
}
}
}
}
I find it hard to help you without looking at any code, but since I don’t understand C# ...
– Paulo
Only with this excerpt still seems to be complicated to offer some solution. We need more information, more relevant excerpts. Do not forget that the correct is [Dit] the question to put the new excerpt.
– Maniero
edited code.
– Guilherme Pires
by chance "codding" is RTF text editor of Windows Forms?
– Leonardo Bosquett