CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: String Arrays

  1. #1
    Join Date
    Oct 2000
    Location
    Upstate NY
    Posts
    249

    String Arrays

    I have 16 strings eminating from 16 buttons corresponding to DTMF keypad buttons.These should be entered into one long string in whatever sequence the buttons were pushed. Sounds like a string array to me but for some reason the confuser doesnt like what I am trying. Any Good words out there?
    73 RSH


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: String Arrays

    If you can code in keypress event (or keyup) why not simply do:

    'set form keypreview to true
    Dim strTheTring
    private Sub Form_KeyPress(KeyAscii as Integer)
    strTheTring = strTheTring & Chr$(KeyAscii)
    End Sub




    and provide a way to clear strTheTring on request
    (ie: pressing Del key?)

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: String Arrays

    Whoops...Did not read your question well... However, you can manage with 16 strings and keypress event:

    Dim firstString as string
    Dim secondString as string
    ...



    or:

    const firstString = "blabla" as string
    ....



    and:

    'set form keypreview to true
    Dim strTheTotal
    private Sub Form_KeyPress(KeyAscii as Integer)
    select case keyascii
    case 0
    strTheTotal = strTheTotal & firstString
    case 1
    strTheTotal = strTheTotal & secondString
    case 2
    ....
    case else
    .....
    end select

    End Sub






    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Oct 2000
    Location
    Upstate NY
    Posts
    249

    Re: String Arrays

    Cimperiali:
    You are right. This can be done without a string array. Your suggestion got me going on a solution (Probably one of many). Each pushbutton generates a character which is sent to 20 lines of strings, and if the string is empty then it assigns a value. That way whatever button is pressed first goes into the first string etc. Then add the strings as they are done and comes out the total number including non numerical characters. A Bit wordy but it works. Probably not a real guru's way.
    73 RSH


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

Featured