Loading ...
Sorry, an error occurred while loading the content.

AW: Please help. I need a snippet or source code for this problem.

Expand Messages
  • pendl2megabit
    Joshua, here is a little starter ;-) ... Stefan Pendl ---code start, watch for line wraps Form created with the help of Freeform 3 v11-20-03 Generated on
    Message 1 of 2 , Nov 4, 2004
      here is a little starter ;-)

      Stefan Pendl

      '---code start, watch for line wraps

      'Form created with the help of Freeform 3 v11-20-03
      'Generated on Nov 04, 2004 at 12:25:50

      '-----Begin code for #main
      WindowWidth = 300
      WindowHeight = 155

      '-----Begin GUI objects code
      statictext #main.hint, "Please enter ZIP Code and hit ENTER", 5, 5,
      280, 25
      textbox #main.zip, 5, 30, 146, 25
      button #main.default,"Search",[search], UL, 190, 30, 96, 25
      statictext #main.txt, "The City is:", 5, 65, 109, 25
      textbox #main.display, 5, 90, 280, 25

      '-----End GUI objects code
      open "ZIP Code Finder" for dialog_nf as #main
      print #main, "font ms_sans_serif 10"
      print #main, "trapclose [quit.main]"

      '-----if we have a huge database let the user know that we are still working
      #main.zip "Please wait ..."
      #main.display "Initializing Database"

      '-----Initialize search base
      baseString$ = ""
      seperator$ = "|"

      read item$
      if item$ <> "@END" then baseString$ = baseString$ + item$ + seperator$
      loop until item$ = "@END"

      #main.zip ""
      #main.display ""
      #main.zip "!setfocus"

      [main.inputLoop] 'wait here for input event

      [search] 'Perform action for the button named 'default'
      City$ = "Not Known"
      #main.zip "!contents? ZIP$"

      '-----get the starting position of the zip
      pos = instr(baseString$, ZIP$ + seperator$)

      '-----get the city, if the zip is contained
      '-----truncate the searchbase to start at our zip
      '-----the city is the secound item ;-)
      if pos > 0 then City$ = word$(mid$(baseString$, pos), 2, seperator$)

      #main.display City$

      [quit.main] 'End the program
      close #main

      '-----Database, can be a Random Access File too ;-)
      data "4580", "Windischgarsten"
      data "4020", "Linz"
      data "1020", "Wien"
      data "4560", "Kirchdorf/Krems"
      data "@END"
      '---code end

      > -----Urspr√ľngliche Nachricht-----
      > Von: Joshua N. Moses
      > I want to write a little program with two textboxes and one command
      > button. The first textbox is for inputting a number -- zip code
      > number. When the command button is hit, the equivalent city/state
      > will pop up in the second textbox.
      > Or better yet, no more command button is needed. Once the zip code
      > number is typed in the first textbox, the second textbox would
      > automatically pop up the city/state.
      > I have tried all the LB samples in the LB 4.01 but I have found no
      > one with that kind of design. I believe I was able to do this in
      > Visual Basic 6 long time ago, because they have a lot of sample
      > programs, but I don't know why I simply could not solve this in LB.
      > I've been trying this for sometime but I simply could not make it.
      > I'm a newbie in computer programming. Thank you very much for any
      > help you can extend to me.
    Your message has been successfully submitted and would be delivered to recipients shortly.