|
-
Apr 14th, 2011, 05:30 PM
#1
Thread Starter
New Member
Text Exchange?
hey guys i need some help, i want what ever the user types in text box1 to be in text box2 EXCEPT i want it to have tags around it. so say a user types "hello" in the first text box i was the second text box to read "!hello!" or something similar.
-
Apr 14th, 2011, 05:31 PM
#2
Re: Text Exchange?
What have you tried that isn't working?
-
Apr 14th, 2011, 05:33 PM
#3
Thread Starter
New Member
Re: Text Exchange?
well im not sure what would work, i know textbox1.text=textbox2.text but im not sure how i would get it to add the extra trags like !hello!
-
Apr 14th, 2011, 05:40 PM
#4
Hyperactive Member
Re: Text Exchange?
try this
vb Code:
textbox2.text = "!" textbox1.text "!"
if you want to use more tags you can use a radio button and use a if statement or select statement..
-
Apr 14th, 2011, 05:42 PM
#5
Thread Starter
New Member
Re: Text Exchange?
i tried it but it says end of statement expected, and im not sure where the end of the statement would go xD
-
Apr 14th, 2011, 05:47 PM
#6
Hyperactive Member
Re: Text Exchange?
sorry my mistake you need to put & before textbox1.text and in the last..
vb Code:
textbox2.text = "!" & textbox1.text & "!"
-
Apr 14th, 2011, 05:51 PM
#7
Thread Starter
New Member
Re: Text Exchange?
thank you very much
-
Apr 14th, 2011, 05:55 PM
#8
Hyperactive Member
Re: Text Exchange?
no problem mate
-
Apr 14th, 2011, 05:59 PM
#9
Thread Starter
New Member
Re: Text Exchange?
lol now that works i run into another issues. well flow i should say. when you type something in the textbox it does appear with !example! but when you type sumthing below that and uncheck the box, the whole thing gets untagged for example
i type hello in textbox1 and check the checkbox, textbox2 reads !hello!
but if it type sumthing under that so textbox1 reads
textbox2 doesnt read
it reads
is there any way i can have it "Save" or store the previously converted text?
-
Apr 14th, 2011, 06:07 PM
#10
Re: Text Exchange?
 Originally Posted by kehran
lol now that works i run into another issues. well flow i should say. when you type something in the textbox it does appear with !example! but when you type sumthing below that and uncheck the box, the whole thing gets untagged for example
i type hello in textbox1 and check the checkbox, textbox2 reads !hello!
but if it type sumthing under that so textbox1 reads
textbox2 doesnt read
it reads
is there any way i can have it "Save" or store the previously converted text?
Doing this might be a littler harder, but no terribly so.
Personally, I'd loop through the TextBox and for each line in the TextBox, use IndexOf to place the exclamation mark at the beginning and end of the line.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Apr 14th, 2011, 06:23 PM
#11
Thread Starter
New Member
Re: Text Exchange?
 Originally Posted by weirddemon
Doing this might be a littler harder, but no terribly so.
Personally, I'd loop through the TextBox and for each line in the TextBox, use IndexOf to place the exclamation mark at the beginning and end of the line.
can you show me how to do that, sorry im not the best at VB
-
Apr 14th, 2011, 06:33 PM
#12
Re: Text Exchange?
 Originally Posted by kehran
can you show me how to do that, sorry im not the best at VB
You're not going to learn if I do it for you. You don't become good at programming by copying and pasting.
But, now that I think about it, that's probably not the best of doing it anyway. Instead, you might want to use String.Split + a combination of a loop and .Lines.
Try this, this, and this, play around with some code and post back the code that isn't working. Actually put some effort into it and we'll view the code that isn't working, then offer suggestions.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Apr 14th, 2011, 06:54 PM
#13
Re: Text Exchange?
Actually, you don't even have to do all that. I just did a quick test and was able to do it:

It was as simple as first declaring a class variable as a List(Of String). You can declare the variable anywhere though.
Then in the CheckBox's CheckChanged event, I looped through each .Line in the TextBox and called .Add on my List(Of String).
Then I looped through each string in the List and added it to the TextBox via:
VB.NET Code:
Me.txtTest2.Text &= Me.txtChar.Text & s & Me.txtChar.Text & Environment.NewLine
If you look through my post carefully, I've given you everything you need to know.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|