'TextBox txt = (TextBox)e.Item.Cells.Controls[0];转换成VB.NET的语法怎么写啊,谢谢

terryxin 2006-03-04 12:33:01
'if (e.Item.ItemType == ListItemType.EditItem)

'{

'for (int i = 0; i < e.Item.Cells.Count; i++)

'{

'TextBox txt = (TextBox)e.Item.Cells.Controls[0];

'txt.Width = Unit.Pixel(50);

'}

'}
...全文
224 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
terryxin 2006-03-04
  • 打赏
  • 举报
回复
在一个DATAGRID的其中一行编辑状态中,自动生成的TEXTBOX的宽度能设置宽度,但上面的好象也不行
singlepine 2006-03-04
  • 打赏
  • 举报
回复
If e.Item.ItemType = ListItemType.EditItem Then
Dim i As Integer = 0
While i < e.Item.Cells.Count
Dim txt As TextBox = CType(e.Item.Cells.Controls(0), TextBox)
txt.Width = Unit.Pixel(50)
End While
End If
cow8063 2006-03-04
  • 打赏
  • 举报
回复
一样的
singlepine 2006-03-04
  • 打赏
  • 举报
回复
用这个工具转一下,然后再少做修改就可以了
http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx
terryxin 2006-03-04
  • 打赏
  • 举报
回复
谢谢大家,搞定,接贴
helloMac 2006-03-04
  • 打赏
  • 举报
回复
1。Dim txtText As New TextBox
要new一个TextBox,VB构造函数语法
2。e.Item.Cells(0).Controls.AddAt(0, txtText)
'e.Item.Cells(0).Controls.Add(txtText)
这个自己选择应用了
helloMac 2006-03-04
  • 打赏
  • 举报
回复

If e.Item.ItemType = ListItemType.EditItem Then
Dim i As Integer
For i = 0 To e.Item.Cells.Count - 1
Dim txtText As New TextBox
e.Item.Cells(0).Controls.AddAt(0, txtText)
'e.Item.Cells(0).Controls.Add(txtText)
txtText.Width = Unit.Pixel(50)
Next i
End If
GSXiaoXiao 2006-03-04
  • 打赏
  • 举报
回复
If e.Item.ItemType = ListItemType.EditItem Then
Dim i As Integer
For i = 0 To e.Item.Cells.Count - 1
Dim txt As TextBox = CType(e.Item.Cells.Controls(0), TextBox)
txt.Width = Unit.Pixel(50)
Next i
End If
dsclub 2006-03-04
  • 打赏
  • 举报
回复
帮忙看看这个http://community.csdn.net/Expert/topic/4592/4592268.xml?temp=.7722742
xcz1943 2006-03-04
  • 打赏
  • 举报
回复
小山正解

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧