Hi Folks;
I have a list box which is populated with data using a filtered data view (just want the name of one column), and then allow users to select an entry from the list, click a corrosponding button, and with the button click event, opens another form and populates the form using a parameter (same one used to populate list box). The result set would be any/all columns returned based on the same parameter.
I have seperate click events for multiple buttons, which all perform the same basic action, with the exception that each button returns data from seperate tables. This works quite well, but...
I attempted to combine the seperate click events into one, and use case select to determine which button was clicked, and return the appropriate results.
The problem that occurs is after converting to a generic click event, the results only return the first row in the dataset, regardless of the list box selection.
I'm including a code snippet with the hopes that someone may be able to catch this issue for me!
PrivateSub AllFindButtons(ByVal sender as system.objectByVal e as System.e.System.EventArgs)Handles btnSuppliersFind.click, btnCustomersfind.click 'cast sender as button type. Dim btn as Button = CType(sender, Button) Dim btnName as String = btn.Name 'determine text fields to use. Dim text as string = string.empty Dim table as System.Data.DataTable = Nothing 'Which text box and data table filter to use. Select Case btnName Case "btnSuppliersFind" text = txtSuppliersName.Text table =NorthwindDataSet.Suppliers Case "btnCustomersFind" txt = txtCustomerName.Text table = NorthwindDataSet.Customers End Select Dim filteredview as Data.DataView = New Data.DataView(table) ' this row filter generalized filteredView.RowFilter = "CompanyName Like '%" + text + "%'" Dim rowsFound As Int32 = filteredView.Count Select Case rowsFound ' which form you show depends on the button name |