Progress Monitor for IdealProgrammer.com
Take Swift, Intelligent, Massive, Planned, Loving, Effective (S.I.M.P.L.E.) Action to Transform Self into Ideal
Skip Repetitive Navigational Links
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console
Please login
VB.NET ASP.NET Filter() Source Code Syntax Example
Description:
Illustrates using Filter with Source Code Syntax Example in VB.NET ASP.NET.
Example Webform Code:
< %@ Page Language="VB" AutoEventWireup="false" CodeFile="Filter.aspx.vb" Inherits="Filter" %> < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <h1><asp:label ID="Label1" runat="server" Text="Label"></asp:label> </h1> <asp:label ID="Label2" runat="server" Text="Label"></asp:label> </div> </form> </body> </html>
Example Code Behind:
Imports System Imports System.IO Imports System.Data ' This example is from http://idealprogrammer.com ' It shows how you can use Filter syntax in VB.NET ASP.NET '**************************************************************************************** ' Purpose: Returns a zero-based array containing a subset of a String array based on ' specified filter criteria. ' ' Syntax: Filter (Source As String(), Match As String, Include As Boolean, _ ' Compare As CompareMethod) As String() ' ' Source - Required - one-dimensional string array to be searched ' Match - required - string to search for ' Include - optional - Boolean value indicating whether to return substrings that ' include or exclude Match. ' Compare - optional - numeric value indicating compare method - CompareMethod.Binary ' or CompareMethod.Text '**************************************************************************************** Partial Class Filter Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label1.Text = "Example #1: Filter(Source, Match, Include,Compare) As String" Dim myStrings(3) As String myStrings(0) = "This" myStrings(1) = "is" myStrings(2) = "my" myStrings(3) = "string" Dim FilteredStrings() As String FilteredStrings = Microsoft.VisualBasic.Filter(myStrings, "is", True, CompareMethod.Text) Dim sb As New StringBuilder For Each myItem As String In FilteredStrings sb.Append(myItem + "<br />") ' Returns ["This", "Is"]. Next Label2.Text = sb.ToString() End Sub End Class
Example Connection String:
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console