Hi i have a problem where i want to use 2 radio buttons to view sum data related to them. e.g. if i select DVD then all the dvd's listed in my database must display, and if select CD then all cd's will be displayed on my data grid(2 radio buttons 1.DVD 2.CD). The problem is that the details of DVD and CD are in a column name called "Album_types".

So how do i view my data by selecting either options to view the related information in my data grid?

Please post your code you have so far. So will come to know your approach to show records.

commented: Posted codn but no reply... +0

This is my coding to selecting radio buttons:
I also want to know , if possible how am i able to refresh my combo box's ,as i have it linked to another form where data is added about a particular album and is searched in this form.

But it does not update to the combo box's if i add or delete a new record.

my combo box's are set to drop down list as want to read the data not to be able to be deleted while searching for the information

Public Class PDL_Test_Coll_Search
    Dim con1 As New SqlClient.SqlConnection("Data Source=CHETS-TOSHIBA\SQLEXPRESS;Initial Catalog=PlanetDiscLibraryTest;Integrated Security=True")
    Dim con2 As New SqlClient.SqlConnection("Data Source=CHETS-TOSHIBA\SQLEXPRESS;Initial Catalog=PlanetDiscLibraryTest;Integrated Security=True")
    Dim da1 As New SqlClient.SqlDataAdapter("select album_id,album_name from album_test", con1)
    Dim da2 As New SqlClient.SqlDataAdapter("select album_name,album_id from album_test", con2)
    Dim dt1 As New DataTable
    Dim dt2 As New DataTable
    Dim aid As String
    Dim aname As String
    Dim dvd As String
    Dim cd As String


    Private Sub PDL_Test_Coll_Search_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con1.Open()
        da1.Fill(dt1)
        CBAID.DataSource = dt1
        CBAID.DisplayMember = "album_id"
        CBAID.ValueMember = "album_id"
        con1.Close()
        con2.Open()
        da2.Fill(dt2)
        cbAName.DataSource = dt2
        cbAName.DisplayMember = "album_name"
        cbAName.ValueMember = "album_name"
        dvd = RBDVDs.Checked
        cd = RBCDS.Checked
    End Sub

    Private Sub btnSearch1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch1.Click
        DataSetAID1.Clear()
        SqlDAdAID.SelectCommand.Parameters("@AID").Value = CBAID.Text
        SqlDAdAID.Fill(DataSetAID1, "album_test")
        SqlDataAdapter1.Fill(DataSetAID1, "trnsaction_test")
        DGridAID.DataMember = "album_test"
        DGridAID.DataSource = DataSetAID1
        aid = CBAID.Text
        If (DataSetAID1.Tables("album_test").Rows.Count > 0) Then
            MessageBox.Show("Album Details Available: " & aid, "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If

    End Sub

    Private Sub btnSearch2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch2.Click
        DataSetAName1.Clear()
        SqlDAdAName.SelectCommand.Parameters("@AName").Value = cbAName.Text
        SqlDAdAName.Fill(DataSetAName1, "album_test")
        SqlDataAdapter1.Fill(DataSetAName1, "trnsaction_test")
        DGridAName.DataSource = DataSetAName1
        DGridAName.DataMember = "album_test"
        aname = cbAName.Text
        If (DataSetAName1.Tables("album_test").Rows.Count > 0) Then
            MessageBox.Show("Album Details Available: " & aname, "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub

    Private Sub btnClear1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear1.Click
        DataSetAID1.Clear()
    End Sub

    Private Sub btnClear2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear2.Click
        DataSetAName1.Clear()
    End Sub

    Private Sub btnSearch3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch3.Click
        DataSetDVDCD1.Clear()
        SqlDataAdapter2.SelectCommand.Parameters("@Val").Value = RBDVDs.Checked
        SqlDataAdapter2.Fill(DataSetDVDCD1, "album_test")
        SqlDataAdapter1.Fill(DataSetATypes1, "trnsaction_test")
        DGridAlbums.DataSource = DataSetDVDCD1
        DGridAlbums.DataMember = "album_test"
        If (RBDVDs.Checked = True) Then

            MessageBox.Show("DVD list available", "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
        DataSetDVDCD1.Clear()
        SqlDataAdapter2.SelectCommand.Parameters("@Val").Value = RBCDS.Checked
        SqlDataAdapter2.Fill(DataSetDVDCD1, "album_test")
        SqlDataAdapter1.Fill(DataSetATypes1, "trnsaction_test")
        DGridAlbums.DataSource = DataSetDVDCD1
        DGridAlbums.DataMember = "album_test"
        If (RBCDS.Checked = True) Then

            MessageBox.Show("CD lis available", "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub

    Private Sub btnClear3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear3.Click
        DataSetDVDCD1.Clear()
    End Sub

    Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
        Me.Refresh()
    End Sub
End Class

Here is a picture of how my search album looks like:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.