lamlamlamiaaa
May 7, 2012, 03:07 PM
So far, I made a program where the user enters a sentence in one textbox and then the user enters a word they want to find in that sentence in another text box. After clicking the button, the program will show the word in capital letters. But, the problem is that, it only capitalizes the first word it finds. For example, "Hi my name is visual basic and I love VIsual basic" IF the user wants to find "Visual" it only capitalizes the first visual and not the second one. I need it so that it does that. Here is my code so far :
Dim sentence As String
Dim word As String
Dim location As String
Dim new_sentence As String
sentence = TextBox1.Text
word = TextBox2.Text
location = InStr(sentence, word)
found = found + 1
new_sentence = Mid(sentence, 1, location - 1) & UCase(word) & Mid(sentence, location + Len(word))
Label3.Text = new_sentence
It would be lots of help!
Thank you (;
Dim sentence As String
Dim word As String
Dim location As String
Dim new_sentence As String
sentence = TextBox1.Text
word = TextBox2.Text
location = InStr(sentence, word)
found = found + 1
new_sentence = Mid(sentence, 1, location - 1) & UCase(word) & Mid(sentence, location + Len(word))
Label3.Text = new_sentence
It would be lots of help!
Thank you (;