delivered the opinion of the court.
This is a companion case to E. I. du Pont de Nemours & Company v. Universal Moulded Products Corporation, ante, page 523, 53 S. E. (2d) 835, this day decided.
After a summons had been issued and served upon the plaintiffs in error to appear and testify on behalf of Universal Moulded Products Corporation before a notary public, in a certain action at law wherein that corporation was the plaintiff and E. I. du Pont de Nemours & Company was the defendant, the plaintiffs in error filed in the court below a notice of motion under the Declaratory Judgment Act1 against Universal Moulded Products Corporation, asking for the entry of a declaratory judgment adjudicating whether they, the plaintiffs in error, could be compelled to so appear and testify. It was the contention of the plaintiffs in error that since they were employees of E. I. du Pont de Nemours & Company, the defendant in the pending action at law, and would be in attendance at the trial, they could not be compelled to appear before a notary public and give their deposition or testify in advance of the trial.
The Universal Moulded Products Corporation filed a demurrer alleging that the notice of motion for judgment was not sufficient in law for the reason that, among other things, it sought a declaratory judgment with respect to the identical matter which was involved in the pending contempt proceeding.
By consent of counsel for all parties the declaratory judgment proceeding was heard along with the contempt *529proceeding. An order was entered in the contempt proceeding adjudicating that the plaintiffs in error were guilty of contempt for their failure to respond to the summons. Our review of that order is the subject of the companion case.
At the same time an order was entered sustaining the demurrer to and dismissing the notice of motion for a declaratory judgment, and to this order the present writ of error has been allowed.
Whether or not jurisdiction shall be taken under the Declaratory Judgment Act in a particular case is within the sound discretion of the trial court. American Nat. Bank, etc., Co. v. Kushner, 162 Va. 378, 386, 174 S. E. 777.
The authorities are in conflict as to whether a court should refuse to entertain an action for a declaratory judgment as to questions which are determinable in a pending action or proceeding. See 16 Am. Jur., Declaratory Judgments, sec. 22, p. 295, and authorities there cited; Anderson on Declaratory Judgments, sec. 55, p. 152 ff. But even in those jurisdictions which hold that the pendency of another proceeding in which relief can be granted does not necessarily preclude the maintenance of a suit for a declaratory judgment, it is held that the trial court may in its sound discretion dismiss the declaratory judgment proceeding and determine the matter in controversy in the other proceeding. See Brillhart v. Excess Ins. Co., 316 U. S. 491, 494, 495, 62 S. Ct. 1173, 86 L. Ed. 1620; Piedmont Fire Ins. Co. v. Aaron, C. C. A. 4, 138 F. (2d) 732, 734.
Plainly, the contempt proceeding and the declaratory judgment proceeding involve the identical question, that is, whether the plaintiffs in error were compelled to obey the summons and appear before the notary public and testify under the circumstances stated. The trial court could have decided the issue in either proceeding, but it was under no compulsion to do so in the declaratory judgment proceeding rather than in the contempt proceeding. Having determined that the matter could be decided in the contempt proceeding, the declaratory judgment proceeding served no further *530purpose and was properly dismissed. See Piedmont Fire Ins. Co. v. Aaron, supra.
The dismissal of the declaratory judgment proceeding should not, of course, deprive the plaintiffs in error of the right to seek a review, in the manner provided by law, of such final judgment as may be entered in the contempt proceeding.
The judgment dismissing this, the declaratory judgment proceeding, will be modified to provide that it is without prejudice to the plaintiffs in error to have their rights finally determined in. the contempt proceeding, and as so modified it is affirmed.
Modified and affirmed.
Acts 1922, ch. 517, p. 902, Michie’s Code of 1942, section 6140a, ff.