i hate mac pc's

hi i would like to know hot to delete all text in a textbox befor a serton letter

for example

dellsrock=cool

i want the dellsrock and the = gone.

thanks for the help.




Re: Visual Basic Express Edition how to i delete words after a sertion word in a textbox?

Solitaire

This will do it: IndexOf will find the location of the character. Substring will return the text starting with that location.

Code Block

Dim mytext As String, loca As Integer

mytext = "dellsrock=cool"

loca = mytext.IndexOf("=")

mytext = mytext.Substring(loca + 1)

MessageBox.Show(mytext)






Re: Visual Basic Express Edition how to i delete words after a sertion word in a textbox?

funky chicken

this is really strange no matter what i do to the code it keeps saying cool

i need it to get the phrase

dellsrock=cool or somthing from TextBox1

then instead of messageBox.show i need it to replacewhats in the textbox.

thanks






Re: Visual Basic Express Edition how to i delete words after a sertion word in a textbox?

Solitaire

I see you are a real beginner without even a grasp of the basic concepts. I wasn't about to spoon-feed you the answer. You were supposed to learn from a working example and adapt the code to suit your own program. You seem to have missed quite a bit. Apparently, you don't even recognize an assignment statement or know what it does. You have a lot to learn.

I simply assigned the value of dellsrock=cool to a string variable but any string could be substituted for that value. You could have changed it to any text that contains a "=" character. That string value represented a sample that you could get from a textbox with user input instead of an assignment statement. The MessageBox.Show sample simply output the result, which is one character past the "=" character in the sample string. You could just as easily place the output in a textbox.

Here is the sample again using two textboxes. You could change it to use only one textbox. I hope you realize that you need to change the names of the controls and variables to those you are using in your program. If you don't understand this much, then I suggest you go back to a beginner's book or tutorial and try out the sample code one by one until you get a better understanding of the basic concepts.

However, I trust this will be helpful and provide the solution you are looking for. Please give it some more thought before you jump to conclusions.

Dim mytext As String, loca As Integer

mytext = TextBox1.Text

loca = mytext.IndexOf("=")

mytext = mytext.Substring(loca + 1)

TextBox2.Text = mytext






Re: Visual Basic Express Edition how to i delete words after a sertion word in a textbox?

funky chicken

thanks for the help. ya im trying to learn more i have to learn hands on i cant learn with tutorials. lol thanks






Re: Visual Basic Express Edition how to i delete words after a sertion word in a textbox?

VBVB66

You should mark Solitaire's post as the answer.