Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 136,414 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,416 people online right now. Registration is fast and FREE... Join Now!




match string

 
Reply to this topicStart new topic

match string

RudyVB.net
14 Oct, 2008 - 09:50 AM
Post #1

D.I.C Head
**

Joined: 3 May, 2008
Posts: 61

Hello All!

I just need to match a string. But the string will be lblSpargo5, or lblSpargo, with any number behind it.

So if I match lblSpargo, I can ignore the number. What is the easiest way of doing this?

Here is my attempt with regual expression.

CODE
Dim Expression As New Regex("^([D{9}])/d$")
        For Each ctl As Control In Me.Controls
            If TypeOf ctl Is Label Then
                lbl = ctl
              
                If Expression.IsMatch(lblSpargo.Name) Then

                    lbl.Text = "Completed"
                End If
            End If
Next


Thanks!

Rudy
User is offlineProfile CardPM
+Quote Post

RudyVB.net
RE: Match String
14 Oct, 2008 - 10:16 AM
Post #2

D.I.C Head
**

Joined: 3 May, 2008
Posts: 61


GOT IT! biggrin.gif

Some times the simplest things make you crazy!
Here what I did

CODE
For Each ctl As Control In Me.Controls
            If TypeOf ctl Is Label Then
                lbl = ctl
                ' If lbl Is Nothing Then
                If lbl.Name.StartsWith("lblSpargo") = True Then


                    lbl.Text = "Completed"
                End If
            End If
        Next


Thanks
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 12:42PM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month