The following example creates an OpenFileDialog, sets several properties, and displays the dialog box using the ShowDialog method.

Break On $System = CreateObject("Kixtart.System") $Form = $System.Form() $Form.Button1 = $Form.Controls.Add("Button") $Form.Button1.Center $Form.Button1.Text = "click..." $Form.Button1.OnClick = "Button1_Click()" $Form.OpenFileDialog1 = $System.OpenFileDialog() $Form.OpenFileDialog1.InitialDirectory = "c:\" $Form.OpenFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" $Form.OpenFileDialog1.FilterIndex = 2 $Form.OpenFileDialog1.RestoreDirectory = True $Form.Show While $Form.Visible $=Execute($Form.DoEvents) Loop Exit 1 Function Button1_Click() If $Form.OpenFileDialog1.ShowDialog() = $System.DialogResult.OK $= $System.MessageBox.Show("You Selected " + $Form.OpenFileDialog1.Filename) EndIf EndFunction




The CHM file was converted to HTML by chm2web software.