Ôõôµã»÷form2Éϵİ´Å¥ ¿ÉÒÔ½áÊøform1ÉÏÕýÔÚ½øÐеÄÑ»· form1ÀïÃæÌí¼ÓÒ»¸ö±äÁ¿£º Public bEnd As Boolean
Ñ»·´úÂëÌí¼Ó£º bEnd = False Do ... If bEnd Then Exit Do DoEvents Loop
ÁíÒ»¸ö´°¿Ú£º frm1.bEnd = True
Ó¦¸Ã¿ÉÐÐ,DoEventsºÜ¹Ø¼ü ÒªÊÇforÑ»·ÄØ£¿ VB code: Option Explicit Dim bolExit As Boolean 'Í˳öÑ»·µÄ±êÖ¾ Private Sub Command1_Click() bolExit = False Do DoEvents '×îºÃÌí¼ÓÕâ¸öÓï¾ä£¬·ÀÖ¹³ÌÐò¼ÙËÀ If Command1.Caption = "¿ªÊ¼Ñ»·" Then Command1.Caption = "Ñ»·Ö´ÐÐÖÐ..." Loop Until bolExit Command1.Caption = "¿ªÊ¼Ñ»·" End Sub
Private Sub Command2_Click() bolExit = True End Sub
Private Sub Form_Load() Command1.Caption = "¿ªÊ¼Ñ»·" Command2.Caption = "½áÊøÑ»·" End Sub