Rowfilter problem

Trixt3r

New member
Joined
Jun 23, 2007
Messages
4
Programming Experience
Beginner
In the code below you'll see my version of a rowfilter. It works fine, but when I close my form I get the following execption:
(valuateException was unhandled)
De bewerking = kan niet worden uitgevoerd op System.Decimal en System.String.

translation ~ the action = can not be performed on System.Decimal and System.String

Why is setupgrid() activated when I close the form?
The value that represents e is the same string everytime I close and the value that represents bron = empty string ""

the code:

Private Sub setupGrid(ByVal e As String, ByVal bron As Object)
Dim dvArtikels As DataView = New DataView(dtArtikels)​
dvArtikels.RowFilter = e & "='" & bron & "'" (the exception refers to this line)​
DataGridView1.DataSource = dvArtikels​
End Sub
 
It has something to do with the format. The format of the column that is the source of the problem is a currency. All the other columns are strings. I've tried converting the currency to a string with following code: CType(bron,string), but the problem stays.
 
it's in your main code window.
 

Attachments

  • Image2.jpg
    Image2.jpg
    9.5 KB · Views: 25
Where can I find that event? Is it in the autogenerated designer code?

Open the form in visual design mode. Click on the form. Click the Lightning bolt in the Properties window. There are all the events for the form

Arg81 way also works. I forget his way because we dont do it like that in C# ;) To find the combo Arg81 refers to, look above the code text editor, when YourForm.vb is open in code view
 
Didn't realise that wasn't shown in C# !

Did it that way as I find it's quicker than the "lightning bolt" method. Each to his own as they say :D

The combos are there, but they only list (on the left) classes present in this file, and (on the right) members [and hidden members because they are in another partial class] of that class


To add an event handler, youre probably supposed to use the code editor.. It discourages questionable practices such as subscribing to ones own events.. i.e. Rather than subscribing to the FormClosing event, I should possibly advocate Overriding the OnFormClosing sub.. Its an ongoing debate :)
 

Latest posts

Back
Top