Announcement

Collapse
No announcement yet.

Getting text out of edit fields and put the string in the URL I am going to launch

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting text out of edit fields and put the string in the URL I am going to launch

    CASE %IDC_LOOKUP
    LOCAL zString AS ASCIIZ * %MAX_PATH
    zString = "http://www.mapquest.com/maps?1c="+IDC_CITY+"&1s="+IDC_STATE+"&1a="+IDC_ADDORINTERSECT+"&1z="+IDC_STARTZIP+"&2c="+IDC_CITY+"&2s="IDC_ENDINGSTATE+"&2a="+IDC_ENDADDINTERSECT+"&2z="+IDC_ENDINGZIPLOCATION
    ShellExecute BYVAL %Null, "open", zString, BYVAL %Null, BYVAL %Null, %SW_ShowNormal
    END SELECT


    Compile failed on line that starts with zString
    I assume I am making a mistake on how to get the text out of the edit fields
    my edit fields are called IDC_NAME, etc. How do I get the text out of the edit field and put the string in the URL that I am going to launch.
    Brian Heibert
    [email protected]
    http://www.heibertsoftware.com
    http://www.winvocalassist.com
    http://www.heibert.net

  • #2
    You can't just concatenate numbers into strings, they have to be converted first. Use FORMAT$ or STR$:

    Code:
    str = str + FORMAT$(%IDC_ADD ORINTERSECT) + str
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Well assuming that you are collecting the different elements of the URL from a dialog on which there are a number of text boxes (edit fields?) that the user has typed into. Maybe you just need to assemble the URL string along these lines?
      Code:
        
      CONTROL GET TEXT hDlg, %IDC_CITY To sTemp
      zString = "[URL]http://www.mapquest.com/maps?1c[/URL]=" + trim$(sTemp)
       
      CONTROL GET TEXT hDlg, %IDC_STATE To sTemp
      zString = zString + Trim$(sTemp)
       
      CONTROL GET TEXT hDlg, %IDC_nnn ..etc
      Rgds, Dave

      Comment


      • #4
        Oops didn't see that, I thought he meant create the string using the actual IDs
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          Originally posted by Kev Peel View Post
          Oops didn't see that, I thought he meant create the string using the actual IDs
          Fooled me too, Kev. Actually I think that exactly what code showing is doing. Even harder to see as it's not formatted with {code} ...{/code}
          Code:
          zString = [URL]http://www.mapquest.com/maps?1c=[/URL] + _
          IDC_CITY+ _ ' Numeric ?
          "&1s="+ _
          IDC_STATE+ _ 'Numeric
          "&1a="+ _
          IDC_ADD ORINTERSECT+ _ 'Numeric
          ...
          Dave is no doubt correct in his assumption that Brian wants the contents of the IDC textboxes but that's NOT what the code shows. {/noodge comment}

          ============================================
          "A fanatic is one who can't change his mind
          and won't change the subject."

          Winston Churchill
          ============================================
          It's a pretty day. I hope you enjoy it.

          Gösta

          JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
          LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

          Comment


          • #6
            Compile failed on line 195: DIM str1,str2,str3,str4,str5,str6,str7,str8 as string

            Actually the title is wrong it's 197 I goofed.

            What is wrong with this code?
            Compile failed at line 197:
            str1 = str + FORMAT$(%IDC_ADDORINTERSECT) + Str


            LOCAL zString AS ASCIIZ * %MAX_PATH

            str1 = str + FORMAT$(%IDC_ADDORINTERSECT) + str
            str2 = str + FORMAT$(%IDC_CITY) + str
            str3 = str + FORMAT$(%IDC_STATE) + str
            str4 = str + FORMAT$(%IDC_STARTZIP) + str
            str5 = str + FORMAT$(%IDC_CITY) + str
            str6 = str + FORMAT$(%IDC_ENDINGSTATE) + str
            str7 = str + FORMAT$(%IDC_ENDADDINTERSECT) + str
            str8 = str + FORMAT$(%IDC_ENDINGZIPLOCATION) + str

            zString = "http://www.mapquest.com/maps?1c="+str2+"&1s="+str3+"&1a="+str1+"&1z="+str4+"&2c="+str5+"&2s="+str6+"&2a="+str7+"&2z="+str8
            ShellExecute BYVAL %Null, "open", zString, BYVAL %Null, BYVAL %Null, %SW_ShowNormal

            Here it is under %IDC_LOOKUP
            CASE %IDC_LOOKUP
            DIM str1,str2,str3,str4,str5,str6,str7,str8 AS STRING
            LOCAL zString AS ASCIIZ * %MAX_PATH

            str1 = str + FORMAT$(%IDC_ADDORINTERSECT) + str
            str2 = str + FORMAT$(%IDC_CITY) + str
            str3 = str + FORMAT$(%IDC_STATE) + str
            str4 = str + FORMAT$(%IDC_STARTZIP) + str
            str5 = str + FORMAT$(%IDC_CITY) + str
            str6 = str + FORMAT$(%IDC_ENDINGSTATE) + str
            str7 = str + FORMAT$(%IDC_ENDADDINTERSECT) + str
            str8 = str + FORMAT$(%IDC_ENDINGZIPLOCATION) + str

            zString = "http://www.mapquest.com/maps?1c="+str2+"&1s="+str3+"&1a="+str1+"&1z="+str4+"&2c="+str5+"&2s="+str6+"&2a="+str7+"&2z="+str8
            ShellExecute BYVAL %Null, "open", zString, BYVAL %Null, BYVAL %Null, %SW_ShowNormal
            END SELECT

            LINE 197 is: DIM str1,str2,str3,str4,str5,str6,str7,str8 as STRING
            Last edited by Brian Heibert; 31 Oct 2008, 02:54 PM.
            Brian Heibert
            [email protected]
            http://www.heibertsoftware.com
            http://www.winvocalassist.com
            http://www.heibert.net

            Comment


            • #7
              Originally posted by Brian Heibert View Post
              What is wrong with this code?
              Compile failed at line 197:
              When the compile fails the compiler tries to help by passing you an error message. It would only be fair to let us know what that was in this case.

              When you post source code on these forums, it is REALLY HELPFUL to those of us with bad eyesight if you enclose it in CODE tags - see the # symbol above the editor pane.

              I also strongly recommend posting compileable code, or just enough code to show the problem. OK so you don't want to post the whole thing for some good reason. In this case, just cut out the parts that DO work until you have pared the code down to a nice small application which illustrates the failure ONLY. If you don't find the fault in that process (whittling down), then you are likely to find it quicker in the forums than if you set an open ended puzzle.

              Yours tedious-old-fartly,

              Chris

              Comment


              • #8
                460 Undefined equate

                I got Error 460 undefined equate on line 205

                Line 205:
                str = str + FORMAT$(%IDC_ENDINGZIPLOCATION) + Str

                Compile failed
                Brian Heibert
                [email protected]
                http://www.heibertsoftware.com
                http://www.winvocalassist.com
                http://www.heibert.net

                Comment


                • #9
                  >str = str + FORMAT$(%IDC_ENDINGZIPLOCATION) + Str

                  You do realize this is not the text in control "%IDC_ENDINGZIPLOCATION," right?

                  I think you want
                  Code:
                  CONTROL GET TEXT CBHNDL, %IDC_ENDINGZIPLOCATION TO  S 
                  Str = Str & S 
                  CONTROL GET TEXT CBHNDL, %IDC_[NEXT_CONTROL]TO  S 
                  Str = Str & S 
                  ....
                  MCM
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment

                  Working...
                  X