
103 S.W.3d 647 (2003)
In re FROST NATIONAL BANK, Relator.
No. 13-03-00001-CV.
Court of Appeals of Texas, Corpus Christi-Edinburg.
March 27, 2003.
Rehearing Overruled May 22, 2003.
*648 Gabriella S. Canales, Alice, for relator.
John R. Resendez, San Antonio, for real party in interest.
Robert J. Vargas, Corpus Christi, for respondent.
Before Justices HINOJOSA, YAÑEZ, and GARZA.

OPINION
Opinion by Justice HINOJOSA.
Relator, Frost National Bank ("Frost"), has filed a petition for writ of mandamus, requesting that this Court order respondent, the Honorable Robert Vargas, presiding judge of the Nueces County Court *649 at Law Number One, to vacate his order granting the motion to transfer venue of the real party in interest, Hector Recio ("Recio"). After receiving a response from the real party in interest, we deny relator's petition for writ of mandamus.
On June 1, 2001, Frost sued Recio in Cause No. 01-61,053-1 in the County Court at Law Number One of Nueces County. Recio was served with citation on September 14, 2001. On October 1, 2001, Recio filed a motion to transfer venue, an answer, and a counterclaim for attorney's fees. On December 20, 2001, a hearing was held and Frost orally moved to dismiss its claim against Recio. Respondent did not grant the dismissal, but asked counsel for Frost to submit an order in writing.
On March 7, 2002, Recio filed a motion for sanctions. The following day, March 8, 2002, respondent signed an order dismissing Frost's claim against Recio. On October 9, 2002, a hearing was held on Recio's motion to transfer venue. Respondent granted Recio's motion and signed an order transferring the suit to the 79th Judicial District Court of Jim Wells County.
Frost contends that the trial court was without jurisdiction on October 9, 2002, when it signed the order transferring the suit to Jim Wells County because Frost's claim against Recio was dismissed, and Recio's claim for attorney's fees and sanctions did not constitute claims for affirmative relief. We disagree.
Mandamus will issue only to correct a clear abuse of discretion when there is no adequate remedy by appeal. Walker v. Packer, 827 S.W.2d 833, 839 (Tex.1992). A trial court abuses its discretion when it does not follow guiding rules and principles and reaches an arbitrary and unreasonable decision. Id.; Republic Royalty Co. v. Evins, 931 S.W.2d 338, 342 (Tex. App.-Corpus Christi 1996, orig. proceeding).
Rule 162 of the Texas Rules of Civil Procedure provides that a plaintiff may dismiss its case any time before it has introduced all of its evidence. The rule further provides:
Any dismissal pursuant to this rule shall not prejudice the right of an adverse party to be heard on a pending claim for affirmative relief or excuse the payment of all costs taxed by the clerk. A dismissal under this rule shall have no effect on any motion for sanctions, attorney's fees or other costs, pending at the time of the dismissal.
Tex.R. Civ. P. 162. A plaintiff's right to dismiss his suit exists from the moment a written motion is filed or an oral motion is made in open court, unless the defendant has, prior to that time, filed pleadings seeking affirmative relief. Greenberg v. Brookshire, 640 S.W.2d 870, 872 (Tex. 1982); Zimmerman v. Ottis, 941 S.W.2d 259, 261 (Tex.App.-Corpus Christi 1996, orig. proceeding); Rosenthal v. Ottis, 865 S.W.2d 525, 527 (Tex.App.-Corpus Christi 1993, orig. proceeding). The trial court loses its plenary power thirty days after it signs an order granting the non-suit, or seventy-five days after it signs an order if a motion for new trial is filed. Harris County Appraisal Dist. v. Wittig, 881 S.W.2d 193, 194 (Tex.App.-Houston [1st Dist.] 1994, no pet.).
The signing of an order of non-suit is important not only because it triggers the appellate deadlines, but also because the trial court by its written order determines what part of the lawsuit is dismissed by the non-suit. Id. The plaintiff does not have an unqualified right to dismiss the entire suit. When the defendant has pending claims for affirmative relief, the plaintiff's request for a non-suit will not result in a dismissal of the entire *650 suit. Gen. Land Office v. OXY U.S.A., Inc., 789 S.W.2d 569, 570 (Tex.1990); Wittig, 881 S.W.2d at 194. Either party can challenge the order of dismissal. Id.
In this case, the respondent signed an order dismissing Frost's claim against Recio on March 8, 2002. However, prior to the dismissal, Recio asserted a claim for attorney's fees in his original answer. The general rule is that a counterclaim for attorney's fees by the defendant is considered a claim for affirmative relief, which is not disposed of simply by the plaintiff's dismissal of his own causes of action. Rosenthal, 865 S.W.2d at 527 n. 2. An affirmative claim, stated in an answer, for recovery of attorney's fees for the preparation and prosecution of a defense constitutes a counterclaim. In re C.A.S., No. 05-02-01176, 2003 WL 1226724, at *3, 2003 Tex.App. LEXIS 2284, at *9 (Tex.App.-Dallas March 18, 2003, no pet.) (citing J.C. Hadsell & Co. v. Allstate Ins. Co., 516 S.W.2d 211, 213-14 (Tex.Civ. App.-Texarkana 1974, writ dism'd)).
There is no indication that respondent's order dismissing Frost's claim against Recio dismissed Recio's claim for attorney's fees against Frost. Jurisdiction over the underlying lawsuit depends upon justiciability, and for a controversy to be justiciable, there must be a real controversy between the parties that will be actually resolved by the judicial relief sought. State Bar of Texas v. Gomez, 891 S.W.2d 243, 245 (Tex.1994); Zimmerman, 941 S.W.2d at 263. We conclude that Recio's claim for attorney's fees constitutes a claim for affirmative relief. Therefore, the trial court retains jurisdiction until it hears and determines the claim for attorney's fees.
Because Recio's claim for affirmative relief existed prior to respondent's signing the order of dismissal, and said claim was undetermined, we hold the trial court was appropriately vested with jurisdiction on October 9, 2002, to grant Recio's motion to transfer venue.
Accordingly, we deny relator's petition for writ of mandamus.
