|
-
Jul 11th, 2000, 04:47 PM
#1
Ok, i know this but i cant think of it at the moment. I have a bunch of IF statements and i want it to perform like three things after each IF statement. My prob is i cant remember how to get it to do more that one.
-
Jul 11th, 2000, 04:50 PM
#2
Frenzied Member
Code:
If Text1.Text = "Hello" Then
Msgbox "1"
Msgbox "2"
Msgbox "3"
Endif
-
Jul 11th, 2000, 04:51 PM
#3
Frenzied Member
this might help:
Code:
if something.something then
something
something
something
end if
is this what you mean?
NXSupport - Your one-stop source for computer help
-
Jul 11th, 2000, 04:53 PM
#4
transcendental analytic
if booleanflag then a=b:b=c:c=d
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 11th, 2000, 04:53 PM
#5
_______
<?>
Code:
dim x,y,z
x = 0
y = 1
z = 2
if x = o then
msgbox "help"
if y = 1 then
msgbox "me"
if z = 2 then
msgbox "out"
end if
end if
end if
'or all in one
if x = o and y =1 and z = 2 then msgbox "help me out"
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 11th, 2000, 05:51 PM
#6
Ok, some of the if statments work, but the others dont even seem to be read.
-
Jul 11th, 2000, 06:22 PM
#7
Post your current code. There might be a fault in the statement themselves.
-
Jul 11th, 2000, 06:24 PM
#8
Hyperactive Member
Nested IF's?
By saying that some work and some do not do you mean that some IF statements are not even reached but that they should be?
Are these nested If's or are they separate if's?
The answers given cover all of these possibilities, so I think you should be able to find the problem now.
Remember that all IF statements MUST have a THEN on the same line. The statements you want to have executed may be on the next line in which case you MUST eventually have and End If.
If the statement you want to execute is on the same line as the THEN clause, then you may not have an End If.
Additonally you can have an ELSE statement.
If by some chance you were trying to think of the Select Case ... End Select statement, then hopefully my mentioning it will remind you...
This is useful for eliminating nested If's that make reading code hard sometimes.
Hope it helps
Paul Lewis
-
Jul 11th, 2000, 06:28 PM
#9
_______
<?>
paste your code so we can see what you
are trying to accomplish..
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 11th, 2000, 06:36 PM
#10
PaulLewis you said "By saying that some work and some do not do you mean that some IF statements are not even reached but that they should be? ". Thats exactly what i mean. Well, here is the code...
Code:
Public Sub Change(CText As String)
Dim i As Integer
Dim stri As String
For i = 1 To Len(CText)
stri = Mid(CText, i, 1)
If stri Like Chr(0) Then stri = Replace(stri, Chr(0), "CHR(0) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(1) Then stri = Replace(stri, Chr(1), "CHR(1) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(2) Then stri = Replace(stri, Chr(2), "CHR(2) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(3) Then stri = Replace(stri, Chr(3), "CHR(3) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(4) Then stri = Replace(stri, Chr(4), "CHR(4) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(5) Then stri = Replace(stri, Chr(5), "CHR(5) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(6) Then stri = Replace(stri, Chr(6), "CHR(6) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(7) Then stri = Replace(stri, Chr(7), "CHR(7) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(8) Then stri = Replace(stri, Chr(8), "CHR(8) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(9) Then stri = Replace(stri, Chr(9), "CHR(9) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(10) Then stri = Replace(stri, Chr(10), "CHR(10) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(11) Then stri = Replace(stri, Chr(11), "CHR(11) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(12) Then stri = Replace(stri, Chr(12), "CHR(12) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(13) Then stri = Replace(stri, Chr(13), "CHR(13) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(14) Then stri = Replace(stri, Chr(14), "CHR(14) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(15) Then stri = Replace(stri, Chr(15), "CHR(15) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(16) Then stri = Replace(stri, Chr(16), "CHR(16) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(17) Then stri = Replace(stri, Chr(17), "CHR(17) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(18) Then stri = Replace(stri, Chr(18), "CHR(18) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(19) Then stri = Replace(stri, Chr(19), "CHR(19) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(20) Then stri = Replace(stri, Chr(20), "CHR(20) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(21) Then stri = Replace(stri, Chr(21), "CHR(21) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(22) Then stri = Replace(stri, Chr(22), "CHR(22) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(23) Then stri = Replace(stri, Chr(23), "CHR(23) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(24) Then stri = Replace(stri, Chr(24), "CHR(24) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(25) Then stri = Replace(stri, Chr(25), "CHR(25) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(26) Then stri = Replace(stri, Chr(26), "CHR(26) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(27) Then stri = Replace(stri, Chr(27), "CHR(27) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(28) Then stri = Replace(stri, Chr(28), "CHR(28) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(29) Then stri = Replace(stri, Chr(29), "CHR(29) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(30) Then stri = Replace(stri, Chr(30), "CHR(30) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(31) Then stri = Replace(stri, Chr(31), "CHR(31) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(32) Then stri = Replace(stri, Chr(32), "CHR(32) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(33) Then stri = Replace(stri, Chr(33), "CHR(33) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(34) Then stri = Replace(stri, Chr(34), "CHR(34) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(35) Then stri = Replace(stri, Chr(35), "CHR(35) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(36) Then stri = Replace(stri, Chr(36), "CHR(36) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(37) Then stri = Replace(stri, Chr(37), "CHR(37) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(38) Then stri = Replace(stri, Chr(38), "CHR(38) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(39) Then stri = Replace(stri, Chr(39), "CHR(39) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(40) Then stri = Replace(stri, Chr(40), "CHR(40) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(41) Then stri = Replace(stri, Chr(41), "CHR(41) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(42) Then stri = Replace(stri, Chr(42), "CHR(42) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(43) Then stri = Replace(stri, Chr(43), "CHR(43) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(44) Then stri = Replace(stri, Chr(44), "CHR(44) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(45) Then stri = Replace(stri, Chr(45), "CHR(45) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(46) Then stri = Replace(stri, Chr(46), "CHR(46) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(47) Then stri = Replace(stri, Chr(47), "CHR(47) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(48) Then stri = Replace(stri, Chr(48), "CHR(48) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(49) Then stri = Replace(stri, Chr(49), "CHR(49) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(50) Then stri = Replace(stri, Chr(50), "CHR(50) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(51) Then stri = Replace(stri, Chr(51), "CHR(51) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(52) Then stri = Replace(stri, Chr(52), "CHR(52) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(53) Then stri = Replace(stri, Chr(53), "CHR(53) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(54) Then stri = Replace(stri, Chr(54), "CHR(54) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(55) Then stri = Replace(stri, Chr(55), "CHR(55) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(56) Then stri = Replace(stri, Chr(56), "CHR(56) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(57) Then stri = Replace(stri, Chr(57), "CHR(57) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(58) Then stri = Replace(stri, Chr(58), "CHR(58) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(59) Then stri = Replace(stri, Chr(59), "CHR(59) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(60) Then stri = Replace(stri, Chr(60), "CHR(60) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(61) Then stri = Replace(stri, Chr(61), "CHR(61) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(62) Then stri = Replace(stri, Chr(62), "CHR(62) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(63) Then stri = Replace(stri, Chr(63), "CHR(63) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(64) Then stri = Replace(stri, Chr(64), "CHR(64) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(65) Then stri = Replace(stri, Chr(65), "CHR(65) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(66) Then stri = Replace(stri, Chr(66), "CHR(66) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(67) Then stri = Replace(stri, Chr(67), "CHR(67) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(68) Then stri = Replace(stri, Chr(68), "CHR(68) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(69) Then stri = Replace(stri, Chr(69), "CHR(69) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(70) Then stri = Replace(stri, Chr(70), "CHR(70) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(71) Then stri = Replace(stri, Chr(71), "CHR(71) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(72) Then stri = Replace(stri, Chr(72), "CHR(72) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(73) Then stri = Replace(stri, Chr(73), "CHR(73) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(74) Then stri = Replace(stri, Chr(74), "CHR(74) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(75) Then stri = Replace(stri, Chr(75), "CHR(75) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(76) Then stri = Replace(stri, Chr(76), "CHR(76) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(77) Then stri = Replace(stri, Chr(77), "CHR(77) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(78) Then stri = Replace(stri, Chr(78), "CHR(78) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(79) Then stri = Replace(stri, Chr(79), "CHR(79) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
1:
Next i
End Sub
It reaches up to like the 33rd or 34th IF statment, but wont go farther then that.
I hope you guys can see something wrong.
-
Jul 11th, 2000, 06:57 PM
#11
Hyperactive Member
-
Jul 11th, 2000, 07:10 PM
#12
Fanatic Member
How about changing the code to something like this:
Code:
Public Sub Change(CText As String)
Dim I As Integer
Dim J As Integer
Dim stri As String
For I = 1 To Len(CText)
stri = Mid(CText, I, 1)
For J = 1 To 79
If stri Like Chr(J) Then
stri = Replace(stri, Chr(J), "CHR(" & J & ")", , , vbTextCompare)
rtfAfter.Text = rtfAfter.Text + stri
GoTo 1
End If
Next J
1:
Next I
End Sub
I think it does what your code does, but it's a little bit shorter (I didn't test it or anything so it might not work)
[Edited by QWERTY on 07-11-2000 at 08:14 PM]
-
Jul 11th, 2000, 07:17 PM
#13
Hyperactive Member
-
Jul 11th, 2000, 07:26 PM
#14
Hyperactive Member
oops
I seem to have replaced your functionality with what I thought you were trying to do.
However, my code does not do what yours did. Your code doesn't reach certain if statements because of the goto statement. Your code allows for multiple matches of the same character due to the way LIKE works.
I have never used LIKE in this way so I was unaware of this behaviour. Did you intend for this to happen?
For example, did you know that character 42 is the "*" symbol?
If you ask VB whether any text is "like *", you will be told YES!
Is this want you want? If not, use my code. If it is what you want, use QWERTY's code.
Regards
Paul Lewis
-
Jul 11th, 2000, 07:51 PM
#15
Thank you all for helping, but the most thanks goes to PaulLewis. You told me about the asc() function and now my code looks like this...
Code:
Public Sub Change(CText As String)
Dim i As Integer
Dim stri As String
For i = 1 To Len(CText)
stri = Mid(CText, i, 1)
rtfAfter.Text = rtfAfter.Text & "CHR(" & Asc(stri) & ") "
Next i
End Sub
It works perfectly and is a whole lot faster.
Thank you...
-
Jul 11th, 2000, 08:05 PM
#16
I know this has been answered , but sit back and review your code
-
Jul 11th, 2000, 08:30 PM
#17
I did, i replaced that whole list of ifs with the code i wrote above.
-
Jul 11th, 2000, 09:23 PM
#18
-
Jul 11th, 2000, 09:30 PM
#19
Frenzied Member
I think they teach them that they won Vietnam
-
Jul 11th, 2000, 09:41 PM
#20
Good one Centurian
Yeah the U.S.A was invented to give Aussies something to laugh about, mind you Australia was invented to give Kiwis a good chuckle......
-
Jul 11th, 2000, 09:44 PM
#21
Hyperactive Member
*chuckle*
Jethro, is that my cue to chuckle?
Actually, I'm a big sports fan so I don't have alot to laugh at the Aussies for at present 
Oh well...
-
Jul 11th, 2000, 09:48 PM
#22
Frenzied Member
I don't Care about sport So I get to laugh at England with the Rest of the World
-
Jul 11th, 2000, 09:55 PM
#23
Are you making fun of me cuz i live in america?
Im really Irish.
love me.
please!!!!!!!!
I NEED LOVE!!!!!!!!!!!!!!
-
Jul 11th, 2000, 10:13 PM
#24
-
Jul 11th, 2000, 10:32 PM
#25
Hyperactive Member
OK
I use alot of elseif's and For loops. Usually this gets me through most things. I don't like using select case a whole bunch when I'm checking for cases like case 1 , case 1 + 2, case 1 + 2 + 3.
Aussies make good beer and the English make good ale, and I like to drink both. Then I use my "in-house" plumbing afterward and relize how good it is to live in America where I don't have to go outback or down the hall to relieve myself.
-
Jul 11th, 2000, 10:53 PM
#26
Frenzied Member
Actually They Istalled a Toilet in the Village next to ours 3 Weeks ago, So now it's only a 10 minute walk to the Crapper. It's God Every Modern Convinience as well, Including a nice Fresh supply of leaves next to it.
-
Jul 11th, 2000, 11:00 PM
#27
Hyperactive Member
Well I can't believe it's not butter!
-
Jul 11th, 2000, 11:06 PM
#28
Hyperactive Member
-
Jul 11th, 2000, 11:06 PM
#29
-
Jul 11th, 2000, 11:15 PM
#30
Addicted Member
Hehehehe AUSSIES RULE!!!!!!
Just wait for the swimming at the OLYMPICS....
(oh and by the way 'slab' in australia is a carton of beer - 24 beers)
hehehe and boy thats really a way to get totally wasted...
Reality is an illusion caused by by lack of drugs
Is this real or am i just having a dream?
-
Jul 11th, 2000, 11:22 PM
#31
Paul Lewis you beauty
Originally from Hastings myself, (still a Hawkeye Guy). Have been in oz for approx 20 years, my wife is an aussie, and my dad is an aussie. I support all things Australian...unless....it is against New Zealand.
Thie saturday going out to Stadium Australia to see the All Blacks pound the Wallabies into the dust. Got to be a sight, 100,000 Aussies crying into their beer.
Cullen to score the first try from inside own half.
-
Jul 11th, 2000, 11:36 PM
#32
Hyperactive Member
I could guess
at the number of Aussies and Kiwis posting by the post dates and times.
Unless there are alot of Northern Hemisphere night owls!
As yo know I'm new here and while I have time up my sleeve I'll answer as much as I can (even if I don't know the answer - heehe) since you never know when a mate or two online could come in handy.
-
Jul 12th, 2000, 06:33 AM
#33
Lively Member
whoa this used to be a VB forum.... now its a pub house happy hour!!!
[email protected]
" Programming today is a race between software-engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.
So far the universe is winning". :-)
-
Jul 12th, 2000, 04:39 PM
#34
Sorry Gaurav your right
We should really get John to move this over to Chit Chat now, as the originator of the post has his answer, and we are probably starting to distract people from the real reason for this forum.
-
Jul 12th, 2000, 05:05 PM
#35
transcendental analytic
Code:
Public Sub Change(CText As String)
Dim i As Integer
Dim stri As String
For i = 1 To Len(CText)
stri = Mid(CText, i, 1)
If stri Like Chr(0) Then stri = Replace(stri, Chr(0), "CHR(0) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(1) Then stri = Replace(stri, Chr(1), "CHR(1) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(2) Then stri = Replace(stri, Chr(2), "CHR(2) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(3) Then stri = Replace(stri, Chr(3), "CHR(3) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(4) Then stri = Replace(stri, Chr(4), "CHR(4) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(5) Then stri = Replace(stri, Chr(5), "CHR(5) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(6) Then stri = Replace(stri, Chr(6), "CHR(6) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(7) Then stri = Replace(stri, Chr(7), "CHR(7) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(8) Then stri = Replace(stri, Chr(8), "CHR(8) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(9) Then stri = Replace(stri, Chr(9), "CHR(9) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(10) Then stri = Replace(stri, Chr(10), "CHR(10) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(11) Then stri = Replace(stri, Chr(11), "CHR(11) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(12) Then stri = Replace(stri, Chr(12), "CHR(12) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(13) Then stri = Replace(stri, Chr(13), "CHR(13) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(14) Then stri = Replace(stri, Chr(14), "CHR(14) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(15) Then stri = Replace(stri, Chr(15), "CHR(15) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(16) Then stri = Replace(stri, Chr(16), "CHR(16) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(17) Then stri = Replace(stri, Chr(17), "CHR(17) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(18) Then stri = Replace(stri, Chr(18), "CHR(18) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(19) Then stri = Replace(stri, Chr(19), "CHR(19) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(20) Then stri = Replace(stri, Chr(20), "CHR(20) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(21) Then stri = Replace(stri, Chr(21), "CHR(21) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(22) Then stri = Replace(stri, Chr(22), "CHR(22) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(23) Then stri = Replace(stri, Chr(23), "CHR(23) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(24) Then stri = Replace(stri, Chr(24), "CHR(24) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(25) Then stri = Replace(stri, Chr(25), "CHR(25) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(26) Then stri = Replace(stri, Chr(26), "CHR(26) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(27) Then stri = Replace(stri, Chr(27), "CHR(27) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(28) Then stri = Replace(stri, Chr(28), "CHR(28) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(29) Then stri = Replace(stri, Chr(29), "CHR(29) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(30) Then stri = Replace(stri, Chr(30), "CHR(30) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(31) Then stri = Replace(stri, Chr(31), "CHR(31) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(32) Then stri = Replace(stri, Chr(32), "CHR(32) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(33) Then stri = Replace(stri, Chr(33), "CHR(33) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(34) Then stri = Replace(stri, Chr(34), "CHR(34) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(35) Then stri = Replace(stri, Chr(35), "CHR(35) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(36) Then stri = Replace(stri, Chr(36), "CHR(36) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(37) Then stri = Replace(stri, Chr(37), "CHR(37) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(38) Then stri = Replace(stri, Chr(38), "CHR(38) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(39) Then stri = Replace(stri, Chr(39), "CHR(39) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(40) Then stri = Replace(stri, Chr(40), "CHR(40) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(41) Then stri = Replace(stri, Chr(41), "CHR(41) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(42) Then stri = Replace(stri, Chr(42), "CHR(42) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(43) Then stri = Replace(stri, Chr(43), "CHR(43) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(44) Then stri = Replace(stri, Chr(44), "CHR(44) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(45) Then stri = Replace(stri, Chr(45), "CHR(45) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(46) Then stri = Replace(stri, Chr(46), "CHR(46) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(47) Then stri = Replace(stri, Chr(47), "CHR(47) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(48) Then stri = Replace(stri, Chr(48), "CHR(48) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(49) Then stri = Replace(stri, Chr(49), "CHR(49) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(50) Then stri = Replace(stri, Chr(50), "CHR(50) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(51) Then stri = Replace(stri, Chr(51), "CHR(51) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(52) Then stri = Replace(stri, Chr(52), "CHR(52) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(53) Then stri = Replace(stri, Chr(53), "CHR(53) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(54) Then stri = Replace(stri, Chr(54), "CHR(54) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(55) Then stri = Replace(stri, Chr(55), "CHR(55) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(56) Then stri = Replace(stri, Chr(56), "CHR(56) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(57) Then stri = Replace(stri, Chr(57), "CHR(57) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(58) Then stri = Replace(stri, Chr(58), "CHR(58) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(59) Then stri = Replace(stri, Chr(59), "CHR(59) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(60) Then stri = Replace(stri, Chr(60), "CHR(60) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(61) Then stri = Replace(stri, Chr(61), "CHR(61) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(62) Then stri = Replace(stri, Chr(62), "CHR(62) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(63) Then stri = Replace(stri, Chr(63), "CHR(63) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(64) Then stri = Replace(stri, Chr(64), "CHR(64) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(65) Then stri = Replace(stri, Chr(65), "CHR(65) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(66) Then stri = Replace(stri, Chr(66), "CHR(66) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(67) Then stri = Replace(stri, Chr(67), "CHR(67) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(68) Then stri = Replace(stri, Chr(68), "CHR(68) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(69) Then stri = Replace(stri, Chr(69), "CHR(69) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(70) Then stri = Replace(stri, Chr(70), "CHR(70) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(71) Then stri = Replace(stri, Chr(71), "CHR(71) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(72) Then stri = Replace(stri, Chr(72), "CHR(72) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(73) Then stri = Replace(stri, Chr(73), "CHR(73) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(74) Then stri = Replace(stri, Chr(74), "CHR(74) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(75) Then stri = Replace(stri, Chr(75), "CHR(75) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(76) Then stri = Replace(stri, Chr(76), "CHR(76) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(77) Then stri = Replace(stri, Chr(77), "CHR(77) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(78) Then stri = Replace(stri, Chr(78), "CHR(78) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
If stri Like Chr(79) Then stri = Replace(stri, Chr(79), "CHR(79) ", , , vbTextCompare): rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
1:
Next i
End Sub
WOW! This looks extreemly beautiful!
Well I know you guys discussed this out but this, this is just something that beats all records!
stri = Mid(CText, i, 1) means that stri is 1 character!!
If stri Like Chr(0) Then you use the LIKE operator to compare the strings instead of =!!!!
stri = Replace(stri, Chr(0), "CHR(0) ", , , vbTextCompare)
Replacing all chr(0)'s in the string successfully!!! Nice job! THis is great code!
rtfAfter.Text = rtfAfter.Text + stri: GoTo 1
And then you add the string back again, and then GOTO 1!!!!!!
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 12th, 2000, 05:21 PM
#36
transcendental analytic
Well if you still want a better code, this beats em' all cause it's ten times faster!
Code:
Public Sub Change(CText As String)
Dim a() As Byte, I As Integer
a = StrConv(CText, vbFromUnicode)
For I = 0 To UBound(a)
rtfAfter = rtfAfter & "CHR(" & a(I) & ") "
Next I
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 12th, 2000, 05:53 PM
#37
Now i feel really bad...
and stupid...
and humiliated...
But im feeling better....
I fell better because one day I will rule the world...
the United States of America...
and YOU!!!
-
Jul 12th, 2000, 06:01 PM
#38
Hyperactive Member
No need to feel bad
We are all learning on here otherwise we are wasting our time.
I used to write code like your sample too. You have to remember tha tyour code is still infinitely better than what 99 % of the rest of humanity could accomplish.
You were in the right ballpark to coin a phrase... and you just needed a bit of coaching and maybe one or two net practices 
Keep on asking questions because in the short time I have been here, I have always found people to answer the easy as well as the curly questions 
Cheers
Paul Lewis
-
Jul 12th, 2000, 06:58 PM
#39
Can we move over to Chit Chat with this
monkey boy
We all feel stupid from time to time with coding, there is always something new to learn, if there wasn't then the language would be really boring and l for one would move on to something else. Like l am doing with Pick.
joey o
Got to disagree with you dude. Select Case is superior to Ifs for multiple cases, e.g
Code:
If A = 1 Then
If A = 2 Then
.
.
.
If A = 300 Then
Should be replaced with,
Code:
Select Case A
Case 1
Case 2
.
.
.
Case 300
End Select
The Select case is more efficient in this example, cause not every line is going to be evaluated...
-
Jul 13th, 2000, 12:26 AM
#40
Hyperactive Member
kedaman
Get life Kedaman, Register Mar 2000, 1968 Posts.
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
|