populate listbox with table data
populate listbox with table data
populate listbox with table data
populate listbox with table data
populate listbox with table data
populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data
populate listbox with table data populate listbox with table data
populate listbox with table data
Go Back  Xtreme Visual Basic Talk > > > populate listbox with table data


Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2015, 04:11 PM
gussy81 gussy81 is offline
Newcomer
 
Join Date: Mar 2012
Posts: 3
Default populate listbox with table data


hi i have the following code:

Code:
	
Public Class f

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'LoftDataSet.Services' table. You can move, or remove it, as needed.
        Me.ServicesTableAdapter.Fill(Me.LoftDataSet.Services)

        'Loop through all the rows that are in the dataset
        For Each dr As DataRow In LoftDataSet.Services.Rows

            Dim btn As New Button 'Instantiate a button
            btn.Text = dr("service_name").ToString 'UserName is a field in my Users Table
            btn.Size = New Size(60, 40)
            btn.Tag = dr("ID") 'Here we set the tag to the primary key (ID)

            'Since we're using a flowlayoutpanel, we don't need to worry about setting the location property
            FlowLayoutPanel1.Controls.Add(btn) 'Add the button to the flow layout panel
            AddHandler btn.Click, AddressOf UserClick  'Here we give the button a handler for the click event

        Next
    End Sub

    'Here we write our method for the click event of the button(s) we created

    Private Sub UserClick(ByVal sender As Object, ByVal e As EventArgs)

        'We set a filter to the binding source passing it ID=<and whatever is stored in the tag property>

        ServicesBindingSource.Filter = "ID = " & DirectCast(sender, Button).Tag.ToString


    End Sub

   End Class
i want to be able to have the price field from my table go into the listbox when a button is clicked on the form
Reply With Quote
Reply

Tags
vb.net database


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
populate listbox with table data
populate listbox with table data
populate listbox with table data populate listbox with table data
populate listbox with table data
populate listbox with table data
populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data populate listbox with table data
populate listbox with table data
populate listbox with table data
 
populate listbox with table data
populate listbox with table data
 
-->