Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How Do I??
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Anya




PostPosted: Mon Jun 12, 2006 3:08 pm   Post subject: How Do I??

hypothetical example:
Say i was to create a form where a person was to input there name into a text box. When they chick a command button that name gets replaced with its name backwards. Sara would be araS. How would i do this.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Mon Jun 12, 2006 3:11 pm   Post subject: (No subject)

Do you kow how to get the contents of the text field as a string?
Do you know how to set the contents of the text field?
Do you know how to reverse a string?

If you can answer those three questions with "yes", then you can solve the problem.
Anya




PostPosted: Mon Jun 12, 2006 3:15 pm   Post subject: (No subject)

i know how to do the first one... yes.
the second one... no ttoo sure..
third one do i use Instr or something?
wtd




PostPosted: Mon Jun 12, 2006 3:20 pm   Post subject: (No subject)

Oddly enough, Googling "visual basic reverse string" yields relevant results. Smile

No easy answers with wtd. Wink
GlobeTrotter




PostPosted: Mon Jun 12, 2006 5:02 pm   Post subject: (No subject)

Exactly, there is a built in function in VB to reverse a string. If you really want, you could code it yourself using some other string functions like Mid$().
cool dude




PostPosted: Mon Jun 12, 2006 5:23 pm   Post subject: (No subject)

wtd wrote:
Oddly enough, Googling "visual basic reverse string" yields relevant results. Smile

No easy answers with wtd. Wink


hahaha no easy answer with wtd! Smile reversing a string is really easy! i really hope u know how to use the Mid function. if u don't this is how u use it

code:

txtString.Text = txtString.Text + Mid("String", 3, 2)


the output will be ri. the reason is because it starts from the third letter (first number repersents starting position) and takes two letters (second number represents amound of letters to take)

now since u have the knowledge of the Mid function you should easily be able to figure out how to do the Mid function.

if u still can't then read these hints (pretty much the whole program).
1) determine number of letters of your program by using len function
2)make a for loop going from length of word to 1 by step -1
3)in the for loop make your output text box = output text box + the mid of your word. now carefully think about the numbers (starting position and how many letters to take) u want after the word. think think think...
(if u want to start from the back of your string wat number do u have to put and then u want to take 1 letter at a time) i hope u know wat the numbers that follow the mid function are because that will complete your program. can't give more hints than that because thats telling u the answers

***Biggest hint*** if you have more than 3 lines of code your doing something wrong!!!
wtd




PostPosted: Mon Jun 12, 2006 6:28 pm   Post subject: (No subject)

It's easier than that. You'd know that if you did a Google search on the subject.
cool dude




PostPosted: Mon Jun 12, 2006 7:01 pm   Post subject: (No subject)

wtd wrote:
It's easier than that. You'd know that if you did a Google search on the subject.


why don't i just give him the answer it will be easier that way right. don't encourage him to google it because i'm sure he will find the code on that but he will not learn anything.
Sponsor
Sponsor
Sponsor
sponsor
Anya




PostPosted: Mon Jun 12, 2006 7:14 pm   Post subject: (No subject)

Just thought i would say that i'm a girl... not a guy... but thank you Cool Dude
cool dude




PostPosted: Mon Jun 12, 2006 7:17 pm   Post subject: (No subject)

Anya wrote:
Just thought i would say that i'm a girl... not a guy... but thank you Cool Dude


oh soo sorry hope u accept my appoligies. most of us are guys because statistics show more guys go into computers than girls so i assumed u were a guy, so sorry for that. btw did u solve the problem?
Anya




PostPosted: Mon Jun 12, 2006 9:16 pm   Post subject: (No subject)

thanks Laughing i have a good direction and idea now. I just need to input my code into my program (but it's at another computer) to see if it works. but a final question with regards to the length of the output. if i initiate a starting position, if i do not indicate a stoping position what will happen?
wtd




PostPosted: Mon Jun 12, 2006 9:17 pm   Post subject: (No subject)

cool dude wrote:
wtd wrote:
It's easier than that. You'd know that if you did a Google search on the subject.


why don't i just give him the answer it will be easier that way right. don't encourage him to google it because i'm sure he will find the code on that but he will not learn anything.


Wow. That's quite a contradiction.
cool dude




PostPosted: Tue Jun 13, 2006 4:43 pm   Post subject: (No subject)

Anya wrote:
thanks Laughing i have a good direction and idea now. I just need to input my code into my program (but it's at another computer) to see if it works. but a final question with regards to the length of the output. if i initiate a starting position, if i do not indicate a stoping position what will happen?


if u mean to not indicate a stoping position on your counted loop than your program won't even run try it. if u mean not indicate how many letters to take of the string in your mid function than your program too won't run because its an incorrect statement. u would always need to indicate a stoping position, and even if u forget it won't run so you'll realize u forgot.
Brightguy




PostPosted: Thu Jun 15, 2006 6:41 am   Post subject: Re: How Do I??

If you omit the length, all the characters after the start are returned.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: