如何在Windows窗体c#.net中创建记事本 [英] how to create a notepad in windows form c#.net

查看:125
本文介绍了如何在Windows窗体c#.net中创建记事本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人

我几乎已经创建了一个使用Windows窗体和c#.net的记事本。在这个应用程序中我使用了richTextBox和menustrip控件,所有编码我已经完成但单词warp代码不起作用,我使用此代码但此代码显示错误实例引用未设置

wordWrapToolStripMenuItem .Checked =!(wordWrapToolStripMenuItem.Checked);

richTextBox1.WordWrap = wordWrapToolStripMenuItem.Checked;

请帮助我并建议wordwrap代码

还告诉我代码查找,查找下一个,替换和转到。

Dear All
I have almost crated a notepad for using windows form and c#.net . In this application i have used a richTextBox and menustrip control, all coding i have done but word warp code not work, i have using this code but this code show an error "instance ref not set"
wordWrapToolStripMenuItem.Checked = !(wordWrapToolStripMenuItem.Checked);
richTextBox1.WordWrap = wordWrapToolStripMenuItem.Checked;
Kindly please help me and advice the code of wordwrap
also advise me the code of find, find next, replace and goto.

推荐答案

我们无法告诉你问题是什么:特别是形成一个小代码片段 - 它在运行时需要访问代码以找出你获得异常的原因。


基本原因很简单:尚未设置某些内容,并且它包含 null - 但我们无法确切地说出来什么。



所以...在调试器中运行你的应用程序,当发生异常时,请查看你的代码。异常将在特定的行上 - 这就是证明错误的行。因此,将鼠标指针依次悬停在线上的每个项目上,查找哪一个 null

当你找到它时,你可以回顾一下你的代码,找出 为什么 它是null - 但这将取决于它是什么,以及何时执行代码。快点 - 调试器非常强大,但是如果你从调试菜单开始并在找到执行相同操作的按钮之前找出你可以做的事情,那么调试器非常简单。
We can't tell you what the problem is: particularly form that small a code fragment - it needs access to the code while it is running to work out why you are getting the exception.

The basic reason is simple: something is not set yet, and it contains null - but we can't tell exactly what.

So...run your application in the debugger and when the exception happens look at your code. The exception will be on a particular line - and that's the one that is demonstrating the error. So hover the mouse pointer over each item on the line in turn, looking for which one is null.
When you find it, you can then look back in your code to find out why it is null - but that will depend on what it is, and when the code is being executed. Have a go - the debugger is very powerful, but pretty simple to use if you start with the "Debug" menu and find out what you can do before looking for the buttons which do the same thing.


这篇关于如何在Windows窗体c#.net中创建记事本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆