If you've ever had your credit card stolen, or been a victim of identity theft, you know how frustrating it is. Atop of the potential of losing money, you also have the stressful, time-consuming ordeal of contacting the appropriate companies to cancel your card and make sure your credit isn't damaged. Now imagine that you're a company entrusted with protecting such personal information provided by your customers, and your systems get breached. As TJX (NYSE:TJX) has discovered, the ramifications are costly and long-lasting.

The company, better known by its T.J. Maxx and Marshalls store names, reported first-quarter results hindered by the hacking it suffered in December 2006. The retailer earned $162.1 million, or $0.34 per share, essentially flat compared to last year. However, the cyberattack cost the company $12 million in charges, without which it would have earned $0.37 per share.

Despite the theft of their personal information, shoppers continued to search for bargains, enabling TJX to increase sales by 6% to $4.1 billion. Comps inched up 2%, which the company said lagged expectations, as a result of poor weather in March and April. However, the weather must have been beautiful in Europe, based on the 21% jump in T.K. Maxx comps.

The company expects continued costs from the computer breach, as it pays for the investigation, improves its computer security, and foots legal and other fees. It projects that these costs will diminish its second-quarter results by $0.02 to $0.03 per share. Excluding the charges, the company expects to earn $0.32 to $0.34 per share, with same-store sales increasing 3% to 4%. For the year, it expects to earn $1.80 to $1.85 per share, excluding charges, with comps growth of 3%. Analysts want to see per-share earnings of $0.34 and $1.84 in the quarter and year, respectively.

TJX cannot yet estimate the total costs of this incident, but it still faces lawsuits from banks, consumers, and investors. With so much uncertainty surrounding the company, its stock price has taken a hit lately, making it an interesting consideration for bargain-hunters. Based on trailing P/E, it's slightly pricier than Stein Mart (NASDAQ:SMRT), but cheaper than its main competitor Ross Stores (NASDAQ:ROST), which was recently considered a bargain.

Though it's not perfect (inventory is up, cash is down), TJX is a fundamentally sound business, with decent margins and plenty of confidence despite its recent struggles. After repurchasing $557 million in stock in fiscal 2007, the company plans to purchase an additional $900 million during fiscal 2008. Foolish investors may want to follow the company's lead, particularly when dips occur.

For more on the recent happenings at TJX, check out:

No hacking necessary -- get 30 free days of Motley Fool Stock Advisor access, to check out the Gardner brothers' latest additions to their market-beating stock portfolio.

Fool contributor Mike Cianciolo welcomes feedback and doesn't own any of the companies in this article. The Fool sports a fashionable disclosure policy.