Kageron
Would you like to react to this message? Create an account in a few clicks or log in to continue.

HELP ! mga fellow kageron ! bout listbox s vb.net

2 posters

Go down

HELP ! mga fellow kageron ! bout listbox s vb.net Empty HELP ! mga fellow kageron ! bout listbox s vb.net

Post by y0yie_333 Tue Oct 12, 2010 10:20 am

unzaon pgbuhat sa listbox to listbox ? k ng 2 kbuok ang listbox gni taz ang listbox1 ke dd2 naa butang ang mga MAIN CATEGORY kintahai na'ay category na FOODS, MOVIES, DRINKS then pgclick nmu sa FOODS mugawas daun sa listbox2 ang sub category under sa FOODs nia sa MOviES pd pgclick gawaz pd sub categories under s mga MOVIEz.
ex.
FOODS ---> Kwek2
----> Proven
----> Fish bol
----> ice cream

mmmmm ? k ng database xa. k ng naa n daan s database ipagawas nlng. . . .
tabang mga kageron ! hehehe unzaon mna xa ?
lamat daan dghn

hehehe

y0yie_333
newbie kageron
newbie kageron

Male
Number of posts : 2
Age : 33
Contact Info : 09186837642
Kaged Points : 4973
Registration date : 2010-10-12

Back to top Go down

HELP ! mga fellow kageron ! bout listbox s vb.net Empty Re: HELP ! mga fellow kageron ! bout listbox s vb.net

Post by rodz Thu Oct 28, 2010 12:47 am

here's the code

Code:

Imports System.Data.SqlClient

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim con As SqlConnection = New SqlConnection("connectionString")
        Dim ds As DataSet = New DataSet()
        Dim adapter As SqlDataAdapter = New SqlDataAdapter("Select categoryCode, categoryDescription from CategoryTable", con)
        adapter.Fill(ds)
        lstMainCat.DisplayMember = "categoryDescription"
        lstMainCat.ValueMember = "categoryCode"
        lstMainCat.DataSource = ds
    End Sub

    Private Sub lstMainCat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstMainCat.SelectedIndexChanged
        Dim con As SqlConnection = New SqlConnection("connectionString")
        Dim ds As DataSet = New DataSet()
        Dim adapter As SqlDataAdapter = New SqlDataAdapter(String.Format("Select categoryCode, categoryDescription from SubCategoryTable where parentCategoryCode = '{0}'", lstMainCat.SelectedValue), con)
        adapter.Fill(ds)
        lstSubCat.DisplayMember = "categoryDescription"
        lstSubCat.ValueMember = "categoryCode"
        lstSubCat.DataSource = ds
    End Sub
End Class


Pangutana lang og naa kay wala nasabtan =)

rodz
elite kageron
elite kageron

Male
Number of posts : 277
Age : 38
Contact Info : 09166773249
Kaged Points : 5953
Registration date : 2008-02-10

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum