Click here to Skip to main content
14,837,450 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionexecute in context of different user Pin
TeachesOfPeaches3-May-07 11:35
MemberTeachesOfPeaches3-May-07 11:35 
AnswerRe: execute in context of different user Pin
Dave Kreskowiak4-May-07 3:45
mveDave Kreskowiak4-May-07 3:45 
GeneralRe: execute in context of different user Pin
TeachesOfPeaches4-May-07 4:45
MemberTeachesOfPeaches4-May-07 4:45 
QuestionBubble sort an array of Structure Pin
amatbrewer3-May-07 11:35
Memberamatbrewer3-May-07 11:35 
AnswerRe: Bubble sort an array of Structure Pin
TwoFaced3-May-07 13:35
MemberTwoFaced3-May-07 13:35 
QuestionChecking for overlapping timespans Pin
fp2billiards3-May-07 11:05
Memberfp2billiards3-May-07 11:05 
AnswerRe: Checking for overlapping timespans Pin
Arun.Immanuel3-May-07 15:53
MemberArun.Immanuel3-May-07 15:53 
QuestionUsing a filter on BindingSource with BindingList Pin
Mightor3-May-07 9:44
MemberMightor3-May-07 9:44 
Hi there,

I've been messing with the DataGridView component and it's really quite cool what you can do with it. I have it working for the most part, apart from one thing. I can't seem to get filtering working. The code I have is fort testing purposes only, basically just to get to know how to work with the DGV. I did notice that bSource.SupportsFiltering was set to False and I have no idea how to change that.


Private Sub Dialog1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim bList As New System.ComponentModel.BindingList(Of ListItem)
    Dim bSource As New BindingSource()

    bSource.DataSource = bList

    ' ListItem has Name, ID and Important properties, which are String, Integer and Boolean
    ' respectively.

    bList.Add(New ListItem("Item 1", 1, True))
    bList.Add(New ListItem("Item 2", 2, False))
    bList.Add(New ListItem("Item 3", 3, True))
    bList.Add(New ListItem("Item 4", 4, False))

    DataGridView1.DataSource = bSource

    DataGridView1.ColumnHeadersVisible = False

    ' This makes sure that only 'Important' and 'Name' are shown and displayed
    ' in the correct order
    DataGridView1.Columns(2).DisplayIndex = 0
    DataGridView1.Columns(1).DisplayIndex = 1
    DataGridView1.Columns(0).DisplayIndex = 2
    DataGridView1.Columns(0).Visible = False

    DataGridView1.Columns(2).Width = 20
    DataGridView1.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
    DataGridView1.GridColor = Color.White
    DataGridView1.RowHeadersVisible = False
    DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim bSource As BindingSource = DataGridView1.DataSource
    bSource.Filter = "ID == 2"
    DataGridView1.Refresh()
End Sub


Basically, to test the filter, I wanted to press a button and then apply the filter and have the DGV display only the results of my filter action. I am sure that once I get the hang of the filtering, I can implement it fully in my main app. Does filtering just not work when using a BindingList as your data backend?

Gr,
Mightor

My sig was stolen by a blind monkey.
AnswerRe: Using a filter on BindingSource with BindingList Pin
Dave Kreskowiak4-May-07 3:50
mveDave Kreskowiak4-May-07 3:50 
GeneralRe: Using a filter on BindingSource with BindingList Pin
Mightor4-May-07 9:17
MemberMightor4-May-07 9:17 
QuestionConvert 2003 to 2005 Errors Pin
Central_IT3-May-07 9:34
MemberCentral_IT3-May-07 9:34 
AnswerRe: Convert 2003 to 2005 Errors Pin
Dave Kreskowiak3-May-07 9:42
mveDave Kreskowiak3-May-07 9:42 
GeneralRe: Convert 2003 to 2005 Errors Pin
Central_IT3-May-07 9:49
MemberCentral_IT3-May-07 9:49 
GeneralRe: Convert 2003 to 2005 Errors Pin
Central_IT3-May-07 10:02
MemberCentral_IT3-May-07 10:02 
GeneralRe: Convert 2003 to 2005 Errors Pin
Dave Kreskowiak3-May-07 13:34
mveDave Kreskowiak3-May-07 13:34 
GeneralRe: Convert 2003 to 2005 Errors Pin
Central_IT4-May-07 1:36
MemberCentral_IT4-May-07 1:36 
GeneralRe: Convert 2003 to 2005 Errors Pin
Dave Kreskowiak4-May-07 2:31
mveDave Kreskowiak4-May-07 2:31 
QuestionCreating a Help System for a VB.NET Project Pin
RichFeldman3-May-07 8:23
MemberRichFeldman3-May-07 8:23 
AnswerRe: Creating a Help System for a VB.NET Project Pin
MatrixCoder3-May-07 11:19
MemberMatrixCoder3-May-07 11:19 
Question[02/03] Please help graphing datasource Pin
Srigopal0073-May-07 8:19
MemberSrigopal0073-May-07 8:19 
QuestionError While Creating Publish Pin
vurugonda3-May-07 7:53
Membervurugonda3-May-07 7:53 
QuestionInstalling a Windows Service and the GAC Pin
Terry Porter3-May-07 6:04
MemberTerry Porter3-May-07 6:04 
AnswerRe: Installing a Windows Service and the GAC Pin
kubben3-May-07 6:24
Memberkubben3-May-07 6:24 
GeneralRe: Installing a Windows Service and the GAC Pin
Terry Porter3-May-07 6:33
MemberTerry Porter3-May-07 6:33 
Questionsearch for files Pin
jds12073-May-07 5:35
Memberjds12073-May-07 5:35 

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.