6 Replies - 1631 Views - Last Post: 28 February 2012 - 08:09 PM Rate Topic: -----

#1 xfx   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 15-January 12

vb 6

Posted 28 February 2012 - 07:16 AM

i am new to VB 6.0.... i would lyk to know how can i check an inputed character for uppercase or lowercase..pls some1 help me out
Is This A Good Question/Topic? 0
  • +

Replies To: vb 6

#2 rgfirefly24   User is offline

  • D.I.C Lover
  • member icon


Reputation: 462
  • View blog
  • Posts: 2,204
  • Joined: 07-April 08

Re: vb 6

Posted 28 February 2012 - 08:05 AM

vb6 has functions called toupper and tolower each one returns a string so you can do string comparison to find if your letter is uppercase or lowercase. Basically when you are doing a comparison of the strings you are comparing the ASCII value of each one of them.

ex:

if val = val.toupper() then 
'do something if it is uppercase
else if val = val.tolower() then
'do something if it is lowercase 
end if 



Was This Post Helpful? 0
  • +
  • -

#3 maj3091   User is offline

  • D.I.C Lover
  • member icon

Reputation: 331
  • View blog
  • Posts: 2,005
  • Joined: 26-March 09

Re: vb 6

Posted 28 February 2012 - 08:10 AM

I appreciate you're new here, but please try to read the forum rules before posting, as you'll find that you'll get a much better response.

Firstly, the title VB in a VB forum, doesn't tell anybody anything about your problem. Please try to give meaningful titles to your posts.

This post is also, no doubt related to your original post, so it might have been better if you'd edited or appended to your original post as people have responded to that post.

I'm not trying to come down hard on you, just trying to make your life a little easier in getting answers to your questions.


Lastly, to answer your question, yes you can check, but using the ASCII value of the character and checking if it's in the range for upper or lower case values.

Do a search on the ASC function as a starting point.

View Postrgfirefly24, on 28 February 2012 - 03:05 PM, said:

vb6 has functions called toupper and tolower each one returns a string so you can do string comparison to find if your letter is uppercase or lowercase. Basically when you are doing a comparison of the strings you are comparing the ASCII value of each one of them.

ex:

if val = val.toupper() then 
'do something if it is uppercase
else if val = val.tolower() then
'do something if it is lowercase 
end if 





Are these not VB.Net functions?

If you do it that way, then you could use the UCASE$ and LCASE$ functions.
Was This Post Helpful? 0
  • +
  • -

#4 rgfirefly24   User is offline

  • D.I.C Lover
  • member icon


Reputation: 462
  • View blog
  • Posts: 2,204
  • Joined: 07-April 08

Re: vb 6

Posted 28 February 2012 - 11:41 AM

View Postmaj3091, on 28 February 2012 - 10:10 AM, said:

Are these not VB.Net functions?

If you do it that way, then you could use the UCASE$ and LCASE$ functions.


They are VB.net functions, but I thought they are also vb6 functions. When I do a google search for vb6 .toupper my first result takes me back to dreamincode to the vb6 forum where someone was using it: first result so that is why I gave it to him here. You can use the UCase() and LCase() it would return the same result as it all boils down to doing an ASCII Comparison between the two strings.

This post has been edited by rgfirefly24: 28 February 2012 - 12:35 PM

Was This Post Helpful? 1
  • +
  • -

#5 maj3091   User is offline

  • D.I.C Lover
  • member icon

Reputation: 331
  • View blog
  • Posts: 2,005
  • Joined: 26-March 09

Re: vb 6

Posted 28 February 2012 - 01:00 PM

View Postrgfirefly24, on 28 February 2012 - 06:41 PM, said:

View Postmaj3091, on 28 February 2012 - 10:10 AM, said:

Are these not VB.Net functions?

If you do it that way, then you could use the UCASE$ and LCASE$ functions.


They are VB.net functions, but I thought they are also vb6 functions. When I do a google search for vb6 .toupper my first result takes me back to dreamincode to the vb6 forum where someone was using it: first result so that is why I gave it to him here. You can use the UCase() and LCase() it would return the same result as it all boils down to doing an ASCII Comparison between the two strings.


Wasn't knocking your response mate, was just a question as I'm not familiar with VB.Net personally and I didn't recognise them as VB6 functions (which when you read the full post you linked to, the code changes to .Net part way down).

I actually prefer your method for determining the upper/lower case anyway, then using the ASC function, which was the first thing that came to my mind. :)
Was This Post Helpful? 0
  • +
  • -

#6 rgfirefly24   User is offline

  • D.I.C Lover
  • member icon


Reputation: 462
  • View blog
  • Posts: 2,204
  • Joined: 07-April 08

Re: vb 6

Posted 28 February 2012 - 01:29 PM

No worries, I just wanted to explain where I got them so that I could be corrected if I was wrong, which in doing more reading it looks like I was (In relation to vb6 having .toupper and .tolower). I'm glad we have people who will question something when it doesn't look right. Cheers!
Was This Post Helpful? 0
  • +
  • -

#7 BobRodes   User is offline

  • Product Manager
  • member icon

Reputation: 603
  • View blog
  • Posts: 3,082
  • Joined: 19-May 09

Re: vb 6

Posted 28 February 2012 - 08:09 PM

Microsoft has gone out of their way to make it difficult to find VB6 information. You have to wade through all of the VB.Net stuff to get at it. UCase and LCase are correct, and yes, it's a bit more efficient to put the dollar sign there if you prefer.

The complete VB6 reference (brought to you at enormous expense) is here. You'll want to bookmark the site, as it will probably take an hour of googling to track it down yourself.

This post has been edited by BobRodes: 28 February 2012 - 08:10 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1