我正在使用winforms,我偶尔会更新一个文本框(显示消息).但是,当文本到达框的末尾时,它会生成滚动条,我不知道如何向下滚动到底部.我唯一看到的是ScrollToCaret,但Caret正处于文本的开头.滚动的命令是什么?
我能想到的所有方式看起来都非常苛刻.这样做的正确方法是什么,或者至少是最常见的?
我正在从LINQ-to-SQL查询中检索一组图像,并将它和一些其他数据数据绑定到转发器.我需要在转发器中为每个项添加一个文本框,让用户更改每个图像的标题,与Flickr非常相似.
如何访问转发器控件中的文本框并知道该文本框属于哪个图像?
以下是转发器控件的外观,使用提交按钮更新Linq-to-SQL中的所有图像行:
替代文字http://casonclagg.com/layout.jpg
编辑:
这段代码有效
只要确保你不要像我一样在if(!Page.IsPostBack)之外绑定你的价值.哎呀.
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<div class="itemBox">
<div class="imgclass">
<a title='<%# Eval("Name") %>' href='<%# Eval("Path") %>' rel="gallery">
<img alt='<%# Eval("Name") %>' src='<%# Eval("Path") %>' width="260" />
</a>
</div>
<asp:TextBox ID="TextBox1" Width="230px" runat="server"></asp:TextBox>
</div>
</ItemTemplate>
</asp:Repeater>
Run Code Online (Sandbox Code Playgroud)
并提交点击:
protected void Button1_Click(object sender, EventArgs e)
{
foreach (RepeaterItem item in Repeater1.Items)
{
TextBox txtName = (TextBox)item.FindControl("TextBox1");
if (txtName != null)
{
string val = txtName.Text;
//do something with val
}
}
}
Run Code Online (Sandbox Code Playgroud) 任何人都可以建议如何使用C#处理WinForms文本框中的剪切,复制和粘贴事件?
仅当文本框中的行数大于显示的行数时,是否可以在文本框中显示/隐藏滚动条?
我通过互联网搜索,我必须使用错误的关键字,因为我找不到任何东西.我想创建一个文本框,其文本从远离左侧开始.

就像那样.
我有一个这样的对象:
public class Person : IDataErrorInfo
{
public string PersonName{get;set;}
public int Age{get;set;}
string IDataErrorInfo.this[string propertyName]
{
get
{
if(propertyName=="PersonName")
{
if(PersonName.Length>30 || PersonName.Length<1)
{
return "Name is required and less than 30 characters.";
}
}
return null;
}
}
string IDataErrorInfo.Error
{
get
{
if(PersonName=="Tom" && Age!=30)
{
return "Tom must be 30.";
}
return null;
}
}
}
Run Code Online (Sandbox Code Playgroud)
绑定PersonName和Age属性很简单:
<TextBox Text="{Binding PersonName, ValidatesOnDataErrors=True}" />
<TextBox Text="{Binding Age, ValidatesOnDataErrors=True}" />
Run Code Online (Sandbox Code Playgroud)
但是,如何使用Error属性并正确显示它?
我有一个asp.net mvc应用程序,我正在尝试动态地为我的文本框分配值,但它似乎不起作用(我现在只在IE上测试).这就是我现在所拥有的......
document.getElementsByName('Tue').Value = tue; (顺便说一下tue是一个变量)
我也尝试过这种变化,但它也没有用.
document.getElementsById('Tue').Value = tue; (顺便说一下tue是一个变量)
有人可以告诉我这里哪里出错吗?
给定带有MultiLine = true和的WinForms TextBox控件AcceptsTab == true,如何设置显示的制表符的宽度?
我想将它用作插件的快速和脏脚本输入框.它真的不需要花哨,但如果标签没有显示为8个字符宽,那就太好了......
这不应该让我如此痛苦,但确实如此.这是一个非常奇怪的问题.在GWT应用程序中,我有两个.java文件,login.java和application.java.在login.java中,我正在创建一个用户登录页面,如果验证了用户名和密码,则用户登录到应用程序并且application.java从这里开始.
现在正在申请中.java的onModuleLoad()这就是我从登录页面开始的方式.
public void onModuleLoad() {
Login login = new Login();
login.textBoxUsername.setFocus(true);
RootLayoutPanel.get().add(login);}
Run Code Online (Sandbox Code Playgroud)
这很好用,除了在页面加载时无法将注意力集中在用户名TextBox上的微小问题.我试过了我能想到的东西.但焦点只是没有在TextBox上设置.如果有人可以建议解决方案,请做.非常感谢您的帮助.
解决方案 :(如果它可以帮助任何人面临同样的问题)
final Login login = new Login();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute () {
login.textBoxUsername.setFocus(true);
}
});
RootLayoutPanel.get().add(login);
Run Code Online (Sandbox Code Playgroud) 我明白我们可以使用(javascript)
if (typeof textbox === "object") { }
Run Code Online (Sandbox Code Playgroud)
但有没有方法可以让我确保对象是一个文本框?