Replace String with X's
Posted on 2006-05-11
This is the problem:
Normally on a receipt given back to a customer you want the first 12 numbers of the CC to read X's and only allow the last 4 digits to appear on the receipt.
I have a textbox named txtlog. It holds information passed back to it from a third party DLL for a credit card payment gateway. The CC is Dim CC as string, although the data is credit card numbers.
The sub reads:
Private Sub mnuPurchase_Click()
If (XCTran.PromptCreditCardEntry(ccTransact.hwnd, "Credit Card Purchase Information", False, _
False, False, Swipe, Track1, Track2, CC, CCTypeName, ExpirationMonth, _
ExpirationYear, CardHolderName, ZIP, Address, CVV)) Then
If (XCTran.XCPurchase(ccTransact.hwnd, txtTranFolder.Text, "Purchase", _
chkShowStatus.Value, chkShowResult.Value, txtClerk.Text, txtRcpt.Text, CC, _
ExpirationYear + ExpirationMonth, Swipe, txtAmt.Text, ZIP, _
Address, CVV, ErrorMsg, ApprovalCode, AVSResult, CVVResult)) Then
LogText ("ApprovalCode = " + ApprovalCode)
LogText ("CC = " + CCTypeName)
LogText ("CC = " + CC)
LogText ("TicketID= " + txtRcpt.Text)
LogText ("Purchase Amount= " + txtAmt.Text)
LogText ("XCPurchase Unsuccessfull - " + ErrorMsg)
LogText ("PromptCreditCardEntry Unsuccessfull")
When the result of the CC purchase is successfull, the txtlog.text shows the results .
The LogText ("CC= " +CC) shows the full CC number when I print out the printer command
Printer.Print "CCReceipt"; txtLog.Text since it prints out the txtlog.text which shows the full CC number.
What can I do so that the first 12 digits of the CC number will appear as X's?
Can anyone help me?