Page 1 of 2 12 LastLast
Results 1 to 40 of 60

Thread: I cant believe im asking this

  1. #1
    Guest

    Post

    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.

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Code:
    If Text1.Text = "Hello" Then
    
       Msgbox "1"
       Msgbox "2"
       Msgbox "3"
    
    Endif


  3. #3
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    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

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    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

  6. #6
    Guest
    Ok, some of the if statments work, but the others dont even seem to be read.

  7. #7
    Guest
    Post your current code. There might be a fault in the statement themselves.

  8. #8
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    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

  9. #9
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    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

  10. #10
    Guest
    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.


  11. #11
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Talking No offense dude...

    But I can see why you asked for help.
    Only I don't understand why you said "I can't believe I am asking this..". The code looks to me like you are a beginner and as such you shouldn't worry about what you know/don't know...

    Everyone learns new techniques all the time. The main reason I have started contributing here is because it helps teach me stuff every time I reply

    I will get back to you soon with a solution (as no doubt other helpful people)



    Cheers
    Paul

  12. #12
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    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]

  13. #13
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Wink Another suggestion

    QWERTY beat me to a reply for you however I will still post this in case it helps

    I think the key concepts for you to remember here are:
    IF..THEN..ENDIF syntax.

    ASC(string) returns the ascii value of the first character of the string - this would probably have helped you alot!!

    String addition (concatenation): You can join strings with the & operator.

    Functions: These are good because they return a value to you. This ChangeText function is generic which means you can use it in any code in any project, even if there is no control called "rtfAfter".

    Most important: Whenever you have more than a couple of lines that are exactly the same except for a constant or two, there will always be another way of coding that is shorter, faster and undoubtedly better


    Code:
    Private Sub Command1_Click()
      Dim myText As String
      myText = Chr(3) & "here " & Chr(23)
      rtfAfter.Text = ChangeText(myText)
    End Sub
    
    Public Function ChangeText(CText As String) As String
      Dim i, ascVal As Integer
      Dim stri, newStr  As String
      For i = 1 To Len(CText)
        stri = Mid(CText, i, 1)
        ascVal = Asc(stri)
        If ascVal < 80 Then
          stri = "CHR(" & ascVal & ") "
        End If
        
        newStr = newStr + stri
      
      Next
      ChangeText = newStr
    End Function
    Hope we've all helped

    Paul Lewis

  14. #14
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    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

  15. #15
    Guest
    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...

  16. #16
    Guest

    Thumbs up I know this has been answered , but sit back and review your code

    No offense meant but the original list of Ifs is not good
    coding.

    Replace any huge list of Ifs with the Select Case construct

    Code:
    Select Case stri
       Case Chr(0):Do whatever
       Case Chr(1):Do whatever
    End Select
    Just a thought for your future coding benefit

  17. #17
    Guest
    I did, i replaced that whole list of ifs with the code i wrote above.

  18. #18
    Guest

    Thumbs up Cool...was just pointing out the Select Statement to ya

    We took on a junior programmer from the states this week, who was totally unaware of the Select Case construct. What do they teach people in the US

  19. #19
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    I think they teach them that they won Vietnam

  20. #20
    Guest

    Talking 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......

  21. #21
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Talking *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...




  22. #22
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    I don't Care about sport So I get to laugh at England with the Rest of the World

  23. #23
    Guest
    Are you making fun of me cuz i live in america?
    Im really Irish.













    love me.










    please!!!!!!!!












    I NEED LOVE!!!!!!!!!!!!!!

  24. #24
    Guest

    Talking Ok just kidding...really....honest

    Paul

    Are you a kiwi mate???????

    Monkey Boy

    Of course we are....the rest of the world laughs at seppos, though if your irish it kind of takes the fun out of it.

    Sam

    You old bat youWhat goes around comes around, at least your lads did it against the South Africians in the Rugby

  25. #25
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    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.

  26. #26
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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.

  27. #27
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Well I can't believe it's not butter!
    That arranged can be

  28. #28
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Chit chat

    Yes Jethro I am a Kiwi

    I can see now why so many people have hundreds of messages in the message count And isn't it funny how one little (slightly derogative) comment from Jethro can change a thread rather quickly

    I guess ChimpFace got more that he bargained for in asking the question huh?

    Cheers
    Paul Lewis
    The Kiwi (or one of them anyway)



  29. #29
    Guest

    Wink joey we're all please you live state side as well

    Actually you got the language wrong

    If l wanted to take a piss in the outback, l would have
    to get into my car drive for twenty or so hours to get there.

    In Oz the Outback means the bush...you know the great outdoors, the wilderness, rural areas...

    As in

    "What are you doing this weekend mate?"

    "Going to chuck the old sheila in the ute and go outback
    to shot some roos Bruce. Might even down a slab or two. Yeah, you wouldn't be dead for quids."

  30. #30
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    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?

  31. #31
    Guest

    Thumbs up 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.

  32. #32
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    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.


  33. #33
    Lively Member
    Join Date
    May 1999
    Location
    India
    Posts
    97

    Cool

    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".
    :-)

  34. #34
    Guest

    Unhappy 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.

  35. #35
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  36. #36
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  37. #37
    Guest
    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!!!

  38. #38
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    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

  39. #39
    Guest

    Thumbs up 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...

  40. #40
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274

    kedaman

    Get life Kedaman, Register Mar 2000, 1968 Posts.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width