Click here to Skip to main content
15,886,798 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Problem Saving Data Pin
Richard MacCutchan21-Nov-14 21:23
mveRichard MacCutchan21-Nov-14 21:23 
AnswerRe: Problem Saving Data Pin
den2k8822-Nov-14 1:48
professionalden2k8822-Nov-14 1:48 
GeneralRe: Problem Saving Data Pin
Richard MacCutchan22-Nov-14 2:46
mveRichard MacCutchan22-Nov-14 2:46 
GeneralRe: Problem Saving Data Pin
den2k8822-Nov-14 2:58
professionalden2k8822-Nov-14 2:58 
GeneralRe: Problem Saving Data Pin
Richard MacCutchan22-Nov-14 3:09
mveRichard MacCutchan22-Nov-14 3:09 
AnswerRe: Problem Saving Data Pin
Paolo Mazzon22-Nov-14 6:24
Paolo Mazzon22-Nov-14 6:24 
GeneralRe: Problem Saving Data Pin
Paolo Mazzon22-Nov-14 19:05
Paolo Mazzon22-Nov-14 19:05 
Questionhow do I uncheck a list box in vb.net Pin
ceewhitehead21-Nov-14 3:13
ceewhitehead21-Nov-14 3:13 
Hi all,

I have four selection list boxes.....authorList publisherList yearpublishedList and genreList..
I have managed to write code that enables me to click on 1 or more of the boxes and get a result.
For example if I click on Ken Davies in the Authors list then all his books will appear.I can then click on the second box the publishers list and this will narrow his books down to that publisher and so on.

My problem is this,once I have clicked on any of the lists I have to make a selection in that list.For example if I click on author Ken Davies in the authors list,I can't find a way of "unclicking" that list.I have to stay with it and select another author or otherwise close and open the program again.
The problem being that If I was checking an author,then I decided I just wanted to check genre ,I cant because an author is already selected.
My question is this.Is there a way I can just reset the program,or perhaps is there a way tha I could "uncheck" an item in a list.
Thankyou
VB
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim con As New OleDb.OleDbConnection

        Dim dbProvider As String
        Dim dbSource As String

        Dim ds As New DataSet

        Dim tables As DataTableCollection = ds.Tables

        Dim source1 As New BindingSource()

        Dim da As New OleDb.OleDbDataAdapter

        Dim isFirstColumn As Boolean = True
        Dim author As String = ""
        Dim publisher As String = ""
        Dim yearpublished As String = ""
        Dim genre As String = ""


        Dim aa As String = authorList.Text

        Dim bb As String = publisherList.Text

        Dim cc As String = yearpublishedList.Text

        Dim dd As String = genreList.Text

        Dim astring As String = "SELECT * FROM books "

        If authorList.SelectedIndex > -1 Then
            If isFirstColumn Then
                author = "WHERE author = '" & aa & "' "
            Else
                author = "AND author = '" & aa & "' "
            End If
            isFirstColumn = False
        End If

        If publisherList.SelectedIndex > -1 Then
            If isFirstColumn Then
                publisher = "WHERE publisher = '" & bb & "' " '
            Else
                publisher = "AND publisher = '" & bb & "' "
            End If
            isFirstColumn = False
        End If

        If yearpublishedList.SelectedIndex > -1 Then
            If isFirstColumn Then
                yearpublished = "WHERE yearpublished = '" & cc & "' " '
            Else
                yearpublished = "AND yearpublished = '" & cc & "' "
            End If
            isFirstColumn = False
        End If

        If yearpublishedList.SelectedIndex > -1 Then
            If isFirstColumn Then
                genre = "WHERE genre = '" & dd & "' "
            Else
                genre = "AND genre = '" & dd & "' "
            End If
            isFirstColumn = False
        End If

        dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0;"

        dbSource = "Data Source = C:\Documents and Settings\james\Desktop\authors2.accdb"

        con.ConnectionString = dbProvider & dbSource

        con.Open()



        Dim sql As String = astring & author & publisher & yearpublished & genre

        da = New OleDb.OleDbDataAdapter(sql, con)



        da.Fill(ds, "books")



        Dim view1 As New DataView(tables(0))

        source1.DataSource = view1

        DataGridView1.DataSource = view1

        DataGridView1.Refresh()





<pre lang="vb"><pre lang="vb"><pre lang="vb">

End Sub
End Class
AnswerRe: how do I uncheck a list box in vb.net Pin
ceewhitehead21-Nov-14 6:13
ceewhitehead21-Nov-14 6:13 
SuggestionRe: how do I uncheck a list box in vb.net Pin
Richard Deeming24-Nov-14 2:27
mveRichard Deeming24-Nov-14 2:27 
QuestionPrimary Bugs and Unit Testing Pin
Laiju k11-Nov-14 17:20
professionalLaiju k11-Nov-14 17:20 
AnswerRe: Primary Bugs and Unit Testing Pin
Pete O'Hanlon11-Nov-14 20:32
mvePete O'Hanlon11-Nov-14 20:32 
GeneralRe: Primary Bugs and Unit Testing Pin
Laiju k11-Nov-14 21:30
professionalLaiju k11-Nov-14 21:30 
AnswerRe: Primary Bugs and Unit Testing Pin
Bernhard Hiller11-Nov-14 21:38
Bernhard Hiller11-Nov-14 21:38 
GeneralRe: Primary Bugs and Unit Testing Pin
Laiju k11-Nov-14 22:00
professionalLaiju k11-Nov-14 22:00 
QuestionRfid T5567 Pin
shpetimismajli8-Nov-14 9:34
shpetimismajli8-Nov-14 9:34 
AnswerRe: Rfid T5567 Pin
Dave Kreskowiak8-Nov-14 13:10
mveDave Kreskowiak8-Nov-14 13:10 
QuestionFramework Pin
vivreddiar6-Nov-14 18:21
vivreddiar6-Nov-14 18:21 
AnswerRe: Framework Pin
Pete O'Hanlon6-Nov-14 20:14
mvePete O'Hanlon6-Nov-14 20:14 
GeneralRe: Framework Pin
Richard MacCutchan6-Nov-14 22:09
mveRichard MacCutchan6-Nov-14 22:09 
GeneralRe: Framework Pin
Gerry Schmitz7-Nov-14 12:34
mveGerry Schmitz7-Nov-14 12:34 
QuestionAny real world example of library & framework Pin
iSahilSharma5-Nov-14 0:36
iSahilSharma5-Nov-14 0:36 
AnswerRe: Any real world example of library & framework Pin
Pete O'Hanlon5-Nov-14 0:49
mvePete O'Hanlon5-Nov-14 0:49 
AnswerRe: Any real world example of library & framework Pin
jschell5-Nov-14 10:08
jschell5-Nov-14 10:08 
Question<asp:FileUpload to upload from user pc Pin
byka4-Nov-14 3:46
byka4-Nov-14 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.