[RESOLVED] Simple Question
My goal is to make a label have a caption of a textbox, but it's not that simple... It would be easier to explain with examples.
Example: text1.text has the text:
00000000000`cc2`00000000000000
And then label1.caption will be:
cc2
Is there a code that makes the label have the caption of the textbox between the two ``? Note that sometimes there are more characters before the "``".
(sorry for my bad english, i hope you still understand)
Re: [RESOLVED] Simple Question
I think i marked the thread resolved to early, the code lord orwell gave me didn't do anything...
Re: [RESOLVED] Simple Question
He transposed the InStr() parameters and his final calc was off just a tad; I added the +1 in the final line of code. Try this but ensure you use the correct tick symbol, in the code below ' is used by in your example you used `. Just make sure you are parsing on the correct character
Code:
Dim A As Long, B As Long, C As Long
A = InStr(TEXT1.Text, "'") 'get location of first apostrophe
'if not found exit sub...
If A = 0 Then LABEL1.Text = "": Exit Sub
B = InStr(A + 1, TEXT1.Text, "'") 'search for 2nd apostrophe
C = B - A - 1 'get lengh of string between them
LABEL1.Text = Mid(TEXT1.Text, A + 1, C) 'should return a string starting at postition a length c
Re: [RESOLVED] Simple Question
Ok it works now Thanks Alot!
Re: [RESOLVED] Simple Question
Quote:
Originally Posted by
LaVolpe
He transposed the InStr() parameters and his final calc was off just a tad; I added the +1 in the final line of code. Try this but ensure you use the correct tick symbol, in the code below ' is used by in your example you used `. Just make sure you are parsing on the correct character
Code:
Dim A As Long, B As Long, C As Long
A = InStr(TEXT1.Text, "'") 'get location of first apostrophe
'if not found exit sub...
If A = 0 Then LABEL1.Text = "": Exit Sub
B = InStr(A + 1, TEXT1.Text, "'") 'search for 2nd apostrophe
C = B - A - 1 'get lengh of string between them
LABEL1.Text = Mid(TEXT1.Text, A + 1, C) 'should return a string starting at postition a length c
hehe i clearly stated they might be backwards:rolleyes: