PC Review


Reply
Thread Tools Rate Thread

check control names

 
 
stewart
Guest
Posts: n/a
 
      14th Sep 2007
I would like to be able to run a code that will check to see if a
control has a particular name and then tell me which one has that
name. I thought the code below would work but it does not do the
trick.

Private Sub btnSubmit_Click()

Dim C As Control
For Each C In Me.Controls
If C.Name = "txtnum1" Then
MsgBox C.Name
End If
Next C


End Sub

Additionally is there a way to use a wild card. For example show me
all textboxes that start with txtNum (txtNum1, txtNum2, etc)

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      14th Sep 2007
It worked ok for me.

Maybe you need:

if lcase(c.name) = "txtnum1" then



stewart wrote:
>
> I would like to be able to run a code that will check to see if a
> control has a particular name and then tell me which one has that
> name. I thought the code below would work but it does not do the
> trick.
>
> Private Sub btnSubmit_Click()
>
> Dim C As Control
> For Each C In Me.Controls
> If C.Name = "txtnum1" Then
> MsgBox C.Name
> End If
> Next C
>
> End Sub
>
> Additionally is there a way to use a wild card. For example show me
> all textboxes that start with txtNum (txtNum1, txtNum2, etc)


--

Dave Peterson
 
Reply With Quote
 
stewart
Guest
Posts: n/a
 
      14th Sep 2007
On Sep 13, 8:55 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> It worked ok for me.
>
> Maybe you need:
>
> if lcase(c.name) = "txtnum1" then
>
>
>
> stewart wrote:
>
> > I would like to be able to run a code that will check to see if a
> > control has a particular name and then tell me which one has that
> > name. I thought the code below would work but it does not do the
> > trick.

>
> > Private Sub btnSubmit_Click()

>
> > Dim C As Control
> > For Each C In Me.Controls
> > If C.Name = "txtnum1" Then
> > MsgBox C.Name
> > End If
> > Next C

>
> > End Sub

>
> > Additionally is there a way to use a wild card. For example show me
> > all textboxes that start with txtNum (txtNum1, txtNum2, etc)

>
> --
>
> Dave Peterson


that did the trick...now is there a way to change that so i can search
for a wildcard. i want to find all textboxes that begin with txtNum

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      14th Sep 2007
One way is to just look at the leftmost 6 chars:

if left(lcase(c.name),6) = "txtnum" then



stewart wrote:
>
> On Sep 13, 8:55 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > It worked ok for me.
> >
> > Maybe you need:
> >
> > if lcase(c.name) = "txtnum1" then
> >
> >
> >
> > stewart wrote:
> >
> > > I would like to be able to run a code that will check to see if a
> > > control has a particular name and then tell me which one has that
> > > name. I thought the code below would work but it does not do the
> > > trick.

> >
> > > Private Sub btnSubmit_Click()

> >
> > > Dim C As Control
> > > For Each C In Me.Controls
> > > If C.Name = "txtnum1" Then
> > > MsgBox C.Name
> > > End If
> > > Next C

> >
> > > End Sub

> >
> > > Additionally is there a way to use a wild card. For example show me
> > > all textboxes that start with txtNum (txtNum1, txtNum2, etc)

> >
> > --
> >
> > Dave Peterson

>
> that did the trick...now is there a way to change that so i can search
> for a wildcard. i want to find all textboxes that begin with txtNum


--

Dave Peterson
 
Reply With Quote
 
stewart
Guest
Posts: n/a
 
      14th Sep 2007
On Sep 13, 9:38 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> One way is to just look at the leftmost 6 chars:
>
> if left(lcase(c.name),6) = "txtnum" then
>
>
>
> stewart wrote:
>
> > On Sep 13, 8:55 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > > It worked ok for me.

>
> > > Maybe you need:

>
> > > if lcase(c.name) = "txtnum1" then

>
> > > stewart wrote:

>
> > > > I would like to be able to run a code that will check to see if a
> > > > control has a particular name and then tell me which one has that
> > > > name. I thought the code below would work but it does not do the
> > > > trick.

>
> > > > Private Sub btnSubmit_Click()

>
> > > > Dim C As Control
> > > > For Each C In Me.Controls
> > > > If C.Name = "txtnum1" Then
> > > > MsgBox C.Name
> > > > End If
> > > > Next C

>
> > > > End Sub

>
> > > > Additionally is there a way to use a wild card. For example show me
> > > > all textboxes that start with txtNum (txtNum1, txtNum2, etc)

>
> > > --

>
> > > Dave Peterson

>
> > that did the trick...now is there a way to change that so i can search
> > for a wildcard. i want to find all textboxes that begin with txtNum

>
> --
>
> Dave Peterson


thank you

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I check names in one list agains names in another in excel? =?Utf-8?B?Sm9obkBIb3NwaWNlIG9mIEhvcGU=?= Microsoft Excel Misc 1 22nd Aug 2006 09:24 AM
how to check all check boxes in repeater control kris Microsoft ASP .NET 1 22nd Sep 2005 08:16 PM
Check names feature not resolving names in Contacts =?Utf-8?B?Ymw=?= Microsoft Outlook Contacts 0 22nd Dec 2004 05:09 PM
Should Form Control names differ from Field names? Bam Bam Microsoft Access 6 22nd Sep 2004 08:08 AM
Check Names and Select Names Outlook Worm Microsoft Outlook Form Programming 3 16th Sep 2004 06:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 PM.