Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Populate(ByVal ComputerID As Integer)
- Dim ds As New DataTable
- ds = FetchSoftware(ComputerID)
- ListBox1 = BindListBoxToTable(ListBox1, "tblSoftware", ds, "SoftwareName", "SoftwareID")
- End Sub
- Function FetchSoftware(ByVal ComputerID As Integer) As Schema.Computer.tblSoftwareDataTable
- Dim ds As Schema.Computer = New Schema.Computer
- SqlHelper.FillDataset( _
- MyConnectionString, _
- "Software_SelectByComputerId", _
- ds, _
- New String() {"tblSoftware"}, _
- New Object() {ComputerID} _
- )
- Return ds.tblSoftware
- End Function
- Function BindListBoxToTable(ByVal LB As ListBox, ByVal TableName As String, _
- ByVal ds As DataTable, ByVal Field As String, ByVal ValueField As String) As ListBox
- LB.DataMember = TableName
- LB.DataSource = ds
- LB.DataValueField = ValueField
- LB.DataTextField = Field
- LB.DataBind()
- Return LB
- End Function
Add Comment
Please, Sign In to add comment