Results 1 to 2 of 2

Thread: I really need help with "KEYASCII =13"

  1. #1

    Thread Starter
    Frenzied Member mxnmx's Avatar
    Join Date
    Dec 2001
    Location
    I'm back...now!!!
    Posts
    1,396

    Exclamation I really need help with "KEYASCII =13"

    This is the code that creates a file that makes the output look like this in HexViewer:
    000001Michael Jackson.000001.123456.445112
    The above line has a certain records...Serial number,name,id number...all assumptions...and in the same file the second record is like this
    000002Bill Clinton.001201.5343432.456789 and in the third record will have the first field as 000003.
    What I want is that the first record will have
    000001Michael Jacson.000001.123456.445112 and then I don't want this number to increment till the 4 the record so the 4th record should look like this:
    000002Bill Clinton.....
    and then the 8th Record will look like
    000003William Gates.....
    I want this number to increment after pressing enter 4 times, but am unable to do it, could anyone help....and in the last line I'm removing 0Ah by CHR$(13), I also wanna remove 0Dh, as the final output file will be viewed in HexViewer.

    If KeyAscii = 13 Then
    lMyNumber = CLng(sMyNumber)
    lMyNumber = lMyNumber + 1
    sMyNumber = Format(CStr(lMyNumber), "000000")
    Print #1, sMyNumber & Trim(txtInput(0).Text); Chr$(13)
    Print #1, Trim(txtInput(1).Text); Chr$(13);
    Print #1, Trim(txtInput(2) + txtInput(3)); Chr$(13);
    Print #1, Trim(txtInput(4).Text); Chr$(13);
    txtInput(0).SetFocus
    Print #1, Trim(txtInput(2).Text) + Trim(txtInput(3))+ Trim(txtInput(4)) Chr$(13);

    End If

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Try something like
    VB Code:
    1. Dim Counter As Long
    2. If KeyAscii = 13 Then
    3.     Counter = Counter + 1
    4.        If Counter > 4 Then
    5.           'do something when the counter hits 4
    6.        End If
    7.     lMyNumber = CLng(sMyNumber)
    8.     lMyNumber = lMyNumber + 1
    9.     sMyNumber = Format(CStr(lMyNumber), "000000")
    10.     Print #1, sMyNumber & Trim(txtInput(0).text); Chr$(13)
    11.     Print #1, Trim(txtInput(1).text); Chr$(13);
    12.     Print #1, Trim(txtInput(2) + txtInput(3)); Chr$(13);
    13.     Print #1, Trim(txtInput(4).text); Chr$(13);
    14.     txtInput(0).SetFocus
    15.     Print #1, Trim(txtInput(2).text) + Trim(txtInput(3)) + Trim(txtInput(4)); Chr$(13);
    16. End If

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