我无法将任何控件添加到我的视觉工作室 [英] I Cant add any control to my visual studio

查看:70
本文介绍了我无法将任何控件添加到我的视觉工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我的Visual Studio无法正常工作
我无法从工具箱中将任何控件添加到表单.
我正在修理.
问题仍然存在.
我现在该怎么办?
我也正在卸载Visual Studio.
并再次设置
但问题仍然存在.
请帮帮我.

Hi My visual studio does''nt work corectly
i cant add any control from my toolbox to the form.
i was repair it.
and the problem exist yet.
what do i do now?
also i was uninstall visual studio.
and again setting up it
but the problem exist yet.
Please help me.
cheers shahin.

推荐答案

我会说你几乎肯定做错了.您是否在许多项目中都尝试过?您确定文件不是只读的吗?您选择一个控件,然后单击该表单将其添加?
I would say you''re almost certainly not doing it right. Have you tried it across many projects ? Are you sure the files are not read only ? You select a control, then click the form to add it ?


1-请不要按"answer"来发布非答案
2-您希望我们做什么?我该如何修理您的计算机? Visual Studio适用于使用它的每个人,因此,除了您的安装以外,我看不到任何问题,或者,如果您删除并重新安装了该程序,那么问题就是我列出的问题之一.我们肯定会根据您含糊不清的帖子为您提供帮助.
1 - please don''t push ''answer'' to post a non answer
2 - what do you expect us to do ? How can I fix your computer ? Visual Studio works for everyone who uses it, so, I don''t see how the problem can be anything but your install or, if you''ve removed and reinstalled the program, then the issue is one of the things I listed. We sure as hell cannot help you based on your vague posts.


只需在c#中创建自定义cortrol
< pre lang ="cs">使用System.ComponentModel;
使用System.Security.Permissions;
使用System.Web;
使用System.Web.UI;
使用System.Web.UI.WebControls;

命名空间Samples.AspNet.CS.Controls
{
[
AspNetHostingPermission(SecurityAction.Demand,
级别= AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
DefaultProperty(& quot;文本& quot;),
ToolboxData(& lt; {0}:WelcomeLabel runat = \&服务器\& quot;& lt;/{0}:WelcomeLabel& quot;)
]
公共类WelcomeLabel:WebControl
{
[
可绑定(true),
类别(外观"),
DefaultValue(&&"),
说明(&欢迎消息文本."),
可本地化(true)
]
公共虚拟字符串Text
{
获取
{
字符串s =(string)ViewState [& quot; Text& quot;] ;;
返回(s == null)吗? String.Empty:s;
}
设置
{
ViewState [& quot;文本& quot]] =值;
}
}

受保护的重写void RenderContents(HtmlTextWriter writer)
{
writer.WriteEncodedText(Text);
如果(上下文!= null)
{
字符串s = Context.User.Identity.Name;
if(s!= null&& s!= String.Empty)
{
string [] split = s.Split(&#39; \\&#39;);
int n = split.Length-1;
如果(split [n]!= String.Empty)
{
writer.Write(&,& quot;);
writer.Write(split [n]);
}
}
}
writer.Write(&!& quot;);
}
}
}</pre>


然后按照以下步骤操作.

< b>•创建ASP.NET服务器控件.
•将元数据添加到控件及其成员,以控制安全性和设计时行为.
•使用ASP.NET网站中的App_Code目录来测试您的控件,而无需手动编译步骤.
•在配置文件和控件的程序集中指定标签前缀.
•将控件编译为程序集并将其添加到Bin目录.
•将位图作为控件的工具箱图标嵌入到控件的程序集中.
•在页面中使用编译后的控件.</b>
just create a custom cortrol in c#
<pre lang="cs">using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Samples.AspNet.CS.Controls
{
[
AspNetHostingPermission(SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.InheritanceDemand,
Level=AspNetHostingPermissionLevel.Minimal),
DefaultProperty(&quot;Text&quot;),
ToolboxData(&quot;&lt;{0}:WelcomeLabel runat=\&quot;server\&quot;&gt; &lt;/{0}:WelcomeLabel&gt;&quot;)
]
public class WelcomeLabel : WebControl
{
[
Bindable(true),
Category(&quot;Appearance&quot;),
DefaultValue(&quot;&quot;),
Description(&quot;The welcome message text.&quot;),
Localizable(true)
]
public virtual string Text
{
get
{
string s = (string)ViewState[&quot;Text&quot;];
return (s == null) ? String.Empty : s;
}
set
{
ViewState[&quot;Text&quot;] = value;
}
}

protected override void RenderContents(HtmlTextWriter writer)
{
writer.WriteEncodedText(Text);
if (Context != null)
{
string s = Context.User.Identity.Name;
if (s != null &amp;&amp; s != String.Empty)
{
string[] split = s.Split(&#39;\\&#39;);
int n = split.Length - 1;
if (split[n] != String.Empty)
{
writer.Write(&quot;, &quot;);
writer.Write(split[n]);
}
}
}
writer.Write(&quot;!&quot;);
}
}
}</pre>


then follow the folowing steps.

<b>•Create an ASP.NET server control.
•Add metadata to the control and its members to control security and design-time behavior.
•Use the App_Code directory in an ASP.NET Web site to test your control without manual compilation steps.
•Specify a tag prefix in a configuration file and in the control''s assembly.
•Compile the control into an assembly and add it to the Bin directory.
•Embed a bitmap into the control''s assembly as the toolbox icon for a visual designer.
•Use the compiled control in a page.</b>


这篇关于我无法将任何控件添加到我的视觉工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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