Results 1 to 9 of 9

Thread: new to visual basic need help with adding text to text box by command button

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2014
    Posts
    8

    Unhappy new to visual basic need help with adding text to text box by command button

    i am using visual basic 6 and i want to make a program that add letters or remove letters from a word in text box and but the result in a label
    for example if i type the word "cat" and click the command button the label shows "cats" but it i type the word "ox" it shows "oxen" and if i type "sheep" it shows "sheep" and "foot" becomes "feet"
    a basic plural program
    i am familiar with the if condition and for next loop but i am unable to do what i want with these alone it just doesn't work
    any help will be appreciated
    thank you

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,871

    Re: new to visual basic need help with adding text to text box by command button

    There is no simple rule for getting the plural out of a singular.

    You can create a table which contains for every word the singular and the plural.
    Or you can implement a smaller table which only contains the exceptions:
    http://www.edufind.com/english-grammar/plural-nouns/

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2014
    Posts
    8

    Re: new to visual basic need help with adding text to text box by command button

    yes i just want the basic rules not the exception like for every word that ends with s or sh add es and for every other word add only s
    and if the word has oo in the middle change them to ee
    i dont know how to write a code for that

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,871

    Re: new to visual basic need help with adding text to text box by command button

    First write what you want to happen to a given singular down on paper.
    These are your logic rules and these logic rules should not be conflicting with each other.

    Example:
    -> Foot
    Add a "s" for the plural
    -> Foots
    Replace "oo" with "ee"
    -> Feets
    The result... Not what you want

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2014
    Posts
    8

    Re: new to visual basic need help with adding text to text box by command button

    cant i make it apply only the rule that turns oo to ee if the word contains oo?

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: new to visual basic need help with adding text to text box by command button

    Turning oo into ee would not be a good idea anyway.

    for example
    Feed is not the plural of Food

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2014
    Posts
    8

    Re: new to visual basic need help with adding text to text box by command button

    these where just examples the language i will be working with is Arabic but i thought English plural would be the closest thing to what i want to do
    i just want a code that analyses the word i but and if a certain condition in a certain letter in that word is met it gives me a certain change in that letter
    like in foot the condition here is that the second and forth letters are o and the result will be to change the third and forth letter to e and show the result on my label is there any code that can do this??

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: new to visual basic need help with adding text to text box by command button

    Quote Originally Posted by mimijem View Post
    these where just examples the language i will be working with is Arabic but i thought English plural would be the closest thing to what i want to do
    i just want a code that analyses the word i but and if a certain condition in a certain letter in that word is met it gives me a certain change in that letter
    like in foot the condition here is that the second and forth letters are o and the result will be to change the third and forth letter to e and show the result on my label is there any code that can do this??
    Yes of course you can do that, it would be simple but as I pointed out the word food meets the same criteria and to change the 0s to Es would create a totally different non plural word.

    Now I have no idea what the rules may be in the language you are talking about so I do not know is this applies there and of course I have no idea how to tell you to create a rule for a language I do not know I can only point out that you example is not a good one as there are several words that may have oo that would not become ee.

    You say you are aware of the If condition and looping so the other things you would need to look at are Instr() , Mid$(), Replace$() and Right$()

  9. #9
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,143

    Re: new to visual basic need help with adding text to text box by command button

    but i thought English plural would be the closest thing to what i want to do
    NOT HARDLY! English HAS to be THE MOST mixed-up jumble of letters/characters in the universe (except Maybe Mandarin!!!). :-)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width