Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issues creating DotNetFactory Radio button using Loop
#1
Not Solved
Hi
I am trying to create a windows form with lots of radio buttons using a For loop (Successful). Later i need to check the value of the (Checked) Property for each radio button object...How can this be done? Below is the code.....

Code:
'Array for the text attachment.
Script = Array("","Script1","Script2","Script3","checkme","Script4")

'Creating Object for Form
Set objForm=DotNetFactory.CreateInstance("System.Windows.Forms.Form","System.Windows.Forms")
Set objBtn2=DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms")
'#################################################################################################################################
'This will provide the locations(X,Y) for the controls
x=10
y=20
'############################################################################################################
'Setting the object drawing point
Set p1=DotNetFactory.CreateInstance("System.Drawing.Point","System.Drawing",x,y)
objForm.Height=1000
objForm.width=1000
'############################################################################################################
'Button with OK as text
objBtn2.Text= "OK"
p1.X=10
p1.Y= 10'60 '200
objBtn2.Location=p1
objForm.CancelButton=objBtn2
'############################################################################################################
'Constant values at the start of the FOR Loop
XValue = 10
YValue = 40
YIncrease = 20
'############################################################################################################
'For Loop
For i = 1 To UBOUND(Script)
    objRdi = objRd & i
    'validation for moving any script after no.25 to the next column
    If i = 25 Then
        MsgBox "check"
        XValue = 500
        YValue = 40
    ElseIf i < 25 Then
        XValue = 10
    End If
    'Creating Object for the radio button
    Set objRdi = DotNetFactory.CreateInstance("System.Windows.Forms.RadioButton", "System.Windows.Forms",
    'Setting properties for the radio button
    objRdi.Text=Script(i)
    objRdi.Name= "objRd" & i
    p1.X= XValue
    p1.Y= YValue
    objRdi.Location=p1
    objRdi.Width=400
    YValue = YValue + YIncrease
    objForm.Controls.Add(objRdi)
    If i = UBOUND(Script) Then
        objForm.Controls.Add(objBtn2)
        objForm.ShowDialog
    End If
Next
'Display based on the radio button
Reply
#2
Not Solved Wink 
I am looking for a similar crack buddy. Anyone out there?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating interface in UFT 15.0 for end user sravanmonty 0 896 07-16-2019, 03:47 AM
Last Post: sravanmonty
Exclamation Creating Simulator using service Test Walaa Elyammany 0 2,335 08-11-2014, 05:21 PM
Last Post: Walaa Elyammany
  Creating or Renaming Column of DataTable at RunTime. Girish_Pai 6 25,975 11-15-2011, 11:08 AM
Last Post: ravi.gajul
  Can't Identify on Second loop MichaelS 2 3,517 10-07-2011, 07:07 PM
Last Post: MichaelS
  How to end script in QTP if the Do Until loop goes to infinite. uma87 3 9,623 09-30-2011, 02:38 PM
Last Post: rajpes

Forum Jump:


Users browsing this thread: 1 Guest(s)