Try this code:

*'Intializing Variables
CONST cord_X = 10
CONST cord_Y = 20
CONST txtWidth = 150
Dim arr_ListItems : arr_ListItems= Array("Index","Draft","Sent
mail","personal mail")
With DOTNetFactory
        'Main-Form
        Set oForm = .CreateInstance("System.Windows.Forms.Form",
"System.Windows.Forms")
        'Main-Form Start Position Object
        Set objStartPos =
DotNetFactory.CreateInstance("System.Windows.Forms.FormStartPosition","System.Windows.Forms")
        'Combobox
        Set oComboBox =
.CreateInstance("System.Windows.Forms.ComboBox","System.Windows.Forms")
        'Point
        Set oPoint = .CreateInstance("System.Drawing.Point",
"System.Drawing", x, y)
        'Buttons
        Set oButton_Cancel = .CreateInstance("System.Windows.Forms.Button",
"System.Windows.Forms")
        Set oButton_Accept = .CreateInstance("System.Windows.Forms.Button",
"System.Windows.Forms")
        'Label_FeedName
        Set oLbl_MailItems =
.CreateInstance("System.Windows.Forms.Label","System.Windows.Forms")
        Set oFont = .CreateInstance("System.Drawing.Font",
"System.Drawing", "Microsoft Sans Serif", 11)
End With

'Label Point
With oPoint
    .x = cord_X
    .y = cord_Y
End With

With oLbl_MailItems
        .Location = oPoint
        .Width = txtWidth
        .Text = "Select Any Mail Link"
        .Font.Style.Bold = oFont.Bold
End With


'Setting ComboBox Point
With oPoint
    .x = cord_X + 130
    .y = cord_Y - 2
End With
'Configuring ComboBox Properties
With oComboBox
    .Location = oPoint
    .Width = txtWidth
    .Name = "cmbBox_EMailLinks"
End With

'Populating Feed-Names in ComboBox
For int_arr_Index = 0 To UBound(arr_ListItems)
    oComboBox.Items.Add arr_ListItems(int_arr_Index)
Next

'Configuring Cancel Button Properties
    With oPoint
        .x = cord_X + 80
        .y = cord_Y + 40
    End With
    With oButton_Accept
        .Location = oPoint
        .Width = 70
        .Text = "Start"
    End With

'------------------------------------------------------------------------------------------------------
    'Configuring Accept Button Properties
    With oPoint
        .x = cord_X + 160
        .y = cord_Y + 40
    End With
    With oButton_Cancel
        .Location = oPoint
        .Width = 70
        .Text = "Stop"
    End With
'------------------------------------------------------------------------------------------------------
'Configuring Main-Form Properties
With oForm
    .Text = "DotNet Factory Demo"
    'Set Form Height
    .Height = 190
    .Width = 500
    .StartPosition = objStartPos.CenterScreen
    'Adding Controls to form
    .Controls.Add oComboBox
    .Controls.Add oLbl_MailItems
    'Adding a Cancel Button
    .CancelButton = oButton_Cancel
    .Controls.Add oButton_Cancel
    'Adding a Accept Button
    .CancelButton = oButton_Accept
    .Controls.Add oButton_Accept
End With

'Show Dialog
oForm.ShowDialog*




Regards
Shalabh Dixit
My QTP Blog <http://shalabhdixit.wordpress.com/>



On Thu, Sep 6, 2012 at 6:16 PM, Akhalesh Yadav
<[email protected]>wrote:

> dear,
>          as per my suggestion you can make an arraylist and add items in it
>
> Set MyList = DotnetFactory.CreateInstance("System.Collections.ArrayList")
> MyList.Add("Index")
> MyList.Add("Draft")
> MyList.Add("Sent mail")
> MyList.Add("personal mail")
>
> if you want to select any one of them you can
> browser("").page("").weblist("").select(MyList(0))
>
>
>
> Thanks
> Akhalesh
>
>
> On Thu, Sep 6, 2012 at 6:06 PM, arpit bansal <
> [email protected]> wrote:
>
>> ITS URGENT.........!!!!!!
>>
>>
>> On Thursday, September 6, 2012 3:49:41 PM UTC+5:30, arpit bansal wrote:
>>>
>>> hi
>>> my mentor assign me the task to create the combo box and listing the
>>> emails link like inbox, sent items , drafts etc. It is easy to login into
>>> the mail by just using qtp but i am not able to create the drop down combo
>>> box and add the items in it. Also unable to guess how to store the selected
>>> values.
>>> Please help me just by giving the simple example to create the drop down
>>> combo box and items it in. Also to store the selected item in variable for
>>> future processing
>>>
>>  --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>>
>
>
>
> --
> Akhalesh yadav
> +919555717928
> +919310680659
>
>  --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to