Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

Should be a really easy if statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jonathan Brown - 08 Mar 2008 20:54 GMT
I need to evaluate the context of a textbox to see if it already contains a
period.  if it does then exit sub, else do this code.

If me.txtbox.text contains a period then
  exit sub
else
  code...
end if

Is there some sort of function for this?  Something like a
contains(me.txtbox.text,".")

I hope this makes sense.
Jonathan Brown - 08 Mar 2008 20:56 GMT
Correction.  evaluate the CONTENTS of a textbox, not context.

> I need to evaluate the context of a textbox to see if it already contains a
> period.  if it does then exit sub, else do this code.
[quoted text clipped - 9 lines]
>
> I hope this makes sense.
kimiraikkonen - 08 Mar 2008 21:07 GMT
On Mar 8, 10:56 pm, Jonathan Brown
<JonathanBr...@discussions.microsoft.com> wrote:
> Correction.  evaluate the CONTENTS of a textbox, not context.
>
[quoted text clipped - 13 lines]
>
> - Show quoted text -

Do you mean:

Public YourSub (....)

If me.txtbox.text.contains("whatsoever") = True Then

 Exit Sub

Else

' ...Code

End if

End Sub
kimiraikkonen - 08 Mar 2008 21:09 GMT
> On Mar 8, 10:56 pm, Jonathan Brown
>
[quoted text clipped - 18 lines]
>
> Do you mean:

Sorry, correcting:

> Public YourSub (....)

Must be:
Public Sub YourSub(...)

' ...

' The rest is same (below).

> If me.txtbox.text.contains("whatsoever") = True Then
>
[quoted text clipped - 9 lines]
>
> - Show quoted text -
Jonathan Brown - 08 Mar 2008 21:40 GMT
perfect!!! thank you.  That's exactly what I needed.  I knew it was something
simple.

> > On Mar 8, 10:56 pm, Jonathan Brown
> >
[quoted text clipped - 43 lines]
> >
> > - Show quoted text -
Jack Jackson - 10 Mar 2008 05:39 GMT
>Correction.  evaluate the CONTENTS of a textbox, not context.
>
[quoted text clipped - 11 lines]
>>
>> I hope this makes sense.

One way to proceed with this sort of question would be to start
typing:
 If me.txtbox.text.
At that point Intellisense will show you what methods are available.
Maybe you can see something that looks like it might do what you want.

Another approach is to realize that me.txtbox.text is a String, and go
look at the properties and methods of the string class.  I prefer
Google for this rather than the built-in help.  Googling for:
.NET string class
will probably show the MSDN documentation for the String class in the
first few hits.
Cor Ligthert[MVP] - 09 Mar 2008 13:18 GMT
Jonathan,

AFAIK is mostly this used to see if something exist in a string

if MyString.IndexOf(0,".") = -1 then 'there is no dot.
(you can concatinate that and find as well the second dot.

Cor

>I need to evaluate the context of a textbox to see if it already contains a
> period.  if it does then exit sub, else do this code.
[quoted text clipped - 9 lines]
>
> I hope this makes sense.
SurturZ - 10 Mar 2008 07:16 GMT
I'm going to suggest INSTR, merely because it is actually BASIC.

Signature

David Streeter
Synchrotech Software
Sydney Australia

> I need to evaluate the context of a textbox to see if it already contains a
> period.  if it does then exit sub, else do this code.
[quoted text clipped - 9 lines]
>
> I hope this makes sense.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.