“无法找到类型或命名空间名称'表单'”在C#在线编译器中 [英] "The type or namespace name 'form' could not be found" in C# online compilers

查看:124
本文介绍了“无法找到类型或命名空间名称'表单'”在C#在线编译器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



首先你应该知道我不是程序员,我只是需要偶尔制作一个程序的人这根本不是我的专业,所以我的问题的某些部分可能听起来有点愚蠢。



我在SharpDevelop的c#中创建了一个程序及其.exe文件工作得很好。但是当我尝试使用一些在线编译器时,它总是返回以下错误:



编译错误(第19行,第34行):类型或命名空间名称'表单'找不到(你错过了使用指令或汇编引用吗?)



我用谷歌搜索但没有任何帮助,原因可能是我做的不理解我应该的方式。你能帮我吗?谢谢。



链接到整个代码: C#Online Compiler | .NET小提琴 [ ^ ]



Hi everyone,

First of all you should know that I am no programmer, I am just a guy who needs to make a program once in a while but it is not my profession at all so some parts of my question may sound kind of dumb to you.

I created a program in c# in SharpDevelop and its .exe file works just fine. But when I try to use some online Compilers, it always return following error:

"Compilation error (line 19, col 34): The type or namespace name 'Form' could not be found (are you missing a using directive or an assembly reference?)"

I was googling hard but nothing helped, the reason probably is that I do not understand the terms the way I should. Can you help me, please? Thank you.

Link to the whole code: C# Online Compiler | .NET Fiddle[^]

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;


namespace citrus
{
	
	public partial class MainForm : Form
	{	string rok, autor, univerzita, katedra;
	int chybovka;
	
	
		public MainForm()
		{





我有什么试过:



谷歌一些信息但没有任何效果



What I have tried:

to google some info but nothing worked

推荐答案

无法访问你的在线编译器和项目我们可以做很多事情。



但是看看ethe错误信息:
Without access to your online compiler and project there isn't a lot we can do.

But look at ethe error message:
Quote:

找不到类型或命名空间名称'Form'(您是否缺少using指令或汇编引用?)

The type or namespace name 'Form' could not be found (are you missing a using directive or an assembly reference?)



重要的一点是结束:


The important bit is the end:

Quote:

你是否缺少using指令或汇编引用?

are you missing a using directive or an assembly reference?



你有使用语句:


You have the using statement:

using System.Windows.Forms;

所以检查你有没有作为项目一部分引用的适当程序集(System.Windows.Forms.dll)

So check you have the appropriate assembly referenced as part of your project (System.Windows.Forms.dll)


联机编译器将在服务器上运行您的代码。如果你能够显示一个表单,它将显示在服务器上,没有人会看到它。



网站没有办法启动编译在您的计算机上执行。如果有,那将是一个主要的安全漏洞。



因此,任何合理的在线编译器都会阻止您的代码启动任何UI。
Online compilers will run your code on the server. If you were able to display a form, it would display on the server, where nobody would ever see it.

There is no way for a website to launch a compiled executable on your computer. If there were, it would be a major security vulnerability.

As a result, any sensible online compiler will prevent your code from launching any UI.


这篇关于“无法找到类型或命名空间名称'表单'”在C#在线编译器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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