Hi ArchAngle,

Number of ways to do this, tell you how I usually implement it. I leverage the TAG property that every object has - its a general-purpose, user-definable variant that you can use to store numbers and strings - in this instance, we will store a flag in the WAIT form tag that gets set depending on which button was clicked. Then we can build that flag into the DoEvents loop. Plus, using this strategy, one can check to see what button was click ... heres your code with the slight modifications:

code:
break on cls

cmdGet_List()

exit

Function cmdGet_List()

Dim $Wait

$Wait = CreateObject("Kixtart.FORM")
$Wait.CAPTION = "Select a Target"
$Wait.SCALEWIDTH = 200
$Wait.SCALEHEIGHT = 250
$Wait.FONTSIZE = 12
$Wait.FONTNAME = "Arial"
$Wait.PrintXY(20,20,"Select Computer Type")
$Wait.CENTER

$Corporate = $Wait.OptionButton
$Corporate.FONTSIZE = 11
$Corporate.FONTNAME = "Arial"
$Corporate.Caption = "Corporate"
$Corporate.Left = 45
$Corporate.Top = 50
$Corporate.Width = 100
$Corporate.Height = 25

$Stores = $Wait.OptionButton
$Stores.Caption = "Stores"
$Stores.Left = 45
$Stores.Top = 80
$Stores.Width = 100
$Stores.Height = 25

$All = $Wait.OptionButton
$All.Caption = "All Units"
$All.Left = 45
$All.Top = 110
$All.Width = 100
$All.Height = 25

$Failed = $Wait.OptionButton
$Failed.Caption = "Failed List"
$Failed.Left = 45
$Failed.Top = 140
$Failed.Width = 130
$Failed.Height = 25

$Button2 = $Wait.CommandButton("Ok")
$Button2.Left = 25
$Button2.Top = 205
$Button2.Width = 50
$Button2.Height = 25
$Button2.OnClick = "$$Wait.Tag=1" ; <--- here

$Button3 = $Wait.CommandButton("Cancel")
$Button3.Left = 105
$Button3.Top = 205
$Button3.Width = 75
$Button3.Height = 25
$Button3.OnClick = 0
$Button3.OnClick = "$$Wait.Tag=2" ; <--- and here

$Wait.Tag = 0 ; <--- here
$Wait.Show
$FORM.Refresh

While $Wait.Visible And Not $Wait.Tag ; <--- here
$=Execute($Wait.DoEvents)
Loop

If $Wait.Tag = 1
?"OK CLICKED"
EndIf

EndFunction

hope this helps.

-Shawn

[ 28. November 2002, 22:10: Message edited by: Shawn ]