读书人

listBox 如何帮定数据

发布时间: 2012-03-31 13:13:26 作者: rapoo

listBox 怎么帮定数据?
listBox 怎么帮定数据?

请据体给个详细代码可以吗?

先谢谢了~

[解决办法]
Public Shared Function HtmlSelectBind(ByVal hs As HtmlSelect, ByVal dt As DataTable, ByVal st As String, ByVal sv As String)
hs.DataSource = dt.DefaultView
hs.DataTextField = st
hs.DataValueField = sv
Try
hs.DataBind()
Return 1
Catch ex As Exception
Return 0
End Try
End Function
End Class
然后绑定时候直接调用这方法
[解决办法]
listbox1.DataBindings.Add(dr( "id "))

读书人网 >VB Dotnet

热点推荐