Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
prompt Dialog Box
#6
Solved: 11 Years, 4 Months ago
Hi Ramesh,
There can be various way of doing this, as suggested by basanth using excel form and through 'hta' using vbscript.
we can do this easily using QTP dotnetfactory.

try this and let me know if it works
Code:
Set oDForm = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")
Set oOpt1 = DotNetFactory.CreateInstance("System.Windows.Forms.CheckBox", "System.Windows.Forms")
Set oOpt2 = DotNetFactory.CreateInstance("System.Windows.Forms.CheckBox", "System.Windows.Forms")
Set oGroupBox = DotNetFactory.CreateInstance("System.Windows.Forms.GroupBox", "System.Windows.Forms")
Set oButton = DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms")

x=10
y=10

Set Pos = DotNetFactory.CreateInstance("System.Drawing.Point","System.Drawing",x,y) '‘This will provide the locations(X,Y) for the controls

oOpt1.Text="Option1"
oGroupBox.Location=Pos

Pos.Y=30

oOpt1.Location=Pos
Pos.Y=CInt(oOpt1.Height)+CInt(oOpt1.Top)+10

oOpt2.Location=Pos
oOpt2.Text="Option2"

oGroupBox.Text="Select Option"
oGroupBox.Controls.Add(oOpt1)
oGroupBox.Controls.Add(oOpt2)
oButton.Text="OK"
Pos.X=60

Pos.Y=CInt(oGroupBox.Height)+20
oButton.Location=Pos
oDForm.CancelButton=oButton

oDForm.Controls.Add(oGroupBox)
oDForm.Controls.Add(oButton)
oDForm.StartPosition=CenterScreen
oDForm.Text="Option Dialog QTP"
oDForm.width = 250
oDForm.height = 190
oDForm.ShowDialog
If oOpt1.Checked Then
    msgbox "You have selected Option 1"
elseif oOpt2.Checked Then
    msgbox "You have selected Option 2"
else
    msgbox "No Option selected"
End If

Reply


Messages In This Thread
prompt Dialog Box - by ramesh.tahiliani - 09-02-2009, 02:45 PM
RE: prompt Dialog Box - by basanth27 - 09-02-2009, 02:51 PM
RE: prompt Dialog Box - by ramesh.tahiliani - 09-02-2009, 04:09 PM
RE: prompt Dialog Box - by basanth27 - 09-02-2009, 04:29 PM
RE: prompt Dialog Box - by ramesh.tahiliani - 09-02-2009, 04:38 PM
RE: prompt Dialog Box - by Saket - 09-02-2009, 05:36 PM
RE: prompt Dialog Box - by Saket - 09-02-2009, 06:11 PM
RE: prompt Dialog Box - by ramesh.tahiliani - 09-02-2009, 06:35 PM
RE: prompt Dialog Box - by basanth27 - 09-02-2009, 06:43 PM
RE: prompt Dialog Box - by Saket - 09-02-2009, 06:43 PM
RE: prompt Dialog Box - by ramesh.tahiliani - 09-02-2009, 08:32 PM
RE: prompt Dialog Box - by ramesh.tahiliani - 09-04-2009, 12:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Automating save dialog box in windows using UFT shipu 0 4,788 01-16-2015, 07:54 PM
Last Post: shipu
  QTP 11 - Chrome 24. Dialog box is identifying as Win object. Kannan R 0 3,096 08-13-2013, 08:10 PM
Last Post: Kannan R
Exclamation Getting run time error while executing the QTP script in command prompt. vishruth143 1 5,659 07-15-2013, 05:41 PM
Last Post: vinod123
  Dialog box differs on different browsers version (IE7 and IE9) for same application visitjaga 1 2,804 12-07-2012, 05:14 PM
Last Post: Ankesh
  Default value in Edit Box when Check Box is checked nacchio 2 5,104 07-18-2012, 12:21 PM
Last Post: sree.85

Forum Jump:


Users browsing this thread: 1 Guest(s)