早上全部
我正在以编程方式从数据库中提取行,并将其列出在我的vb.net应用程序中,就像这样...
Dim linkurl As String = ""
Dim linkdescription As String = ""
Dim adapter As MySqlDataAdapter
Dim hyperlinkresultstable As DataTable
cn.ConnectionString = connection_string
Dim commandtext As String
commandtext = "Select * from mytable where username = '" & "' and type='HYPERLINK';"
adapter = New MySqlDataAdapter(commandtext, cn)
hyperlinkresultstable = New DataTable
adapter.Fill(hyperlinkresultstable)
For Each row As DataRow In hyperlinkresultstable.Rows
linkurl = row.Item("value")
linkdescription = row.Item("description")
quicklinks_layout.RowStyles.Add(New RowStyle(SizeType.AutoSize))
quicklinks_layout.RowCount += 1
quicklinks_layout.Controls.Add(New PictureBox(), 0, quicklinks_layout.RowCount - 1)
quicklinks_layout.Controls.Add(New LinkLabel(), 1, quicklinks_layout.RowCount - 1)
Next row
我以前从未以这种方式工作过,我对如何设置添加的Picturebox的'image'属性一无所知。
我还需要能够基于当前行的链接URL和链接描述来设置链接标签的文本值,工具提示值和mouseclick事件。
任何建议或指导表示赞赏!一如既往的感谢! :)