?
Solved

Best Practice + Adding Items

Posted on 2007-07-24
1
Medium Priority
?
384 Views
Last Modified: 2008-01-09
I have a control which accepts objects of type   ValueListItem, is the following the best way of adding multiple items. Or should I stick with a single vli as just set it to a new one each time

       Dim vli1 As New Infragistics.Win.ValueListItem
        vli1.DisplayText = "Direct Database Connection"
        uceConnectionType.Items.Add(vli1)
        Dim vli2 As New Infragistics.Win.ValueListItem
        vli2.DisplayText = "Connect via Web Service"
        uceConnectionType.Items.Add(vli2)
0
Comment
Question by:rocky050371
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 19558223
I would say the second option is better.  Then you don't have a ton of variables declared cluttering up the code:

    Dim vli As Infragistics.Win.ValueListItem

    vli = New Infragistics.Win.ValueListItem
    vli.DisplayText = "Direct Database Connection"
    uceConnectionType.Items.Add(vli)

    vli = New Infragistics.Win.ValueListItem
    vli.DisplayText = "Connect via Web Service"
    uceConnectionType.Items.Add(vli)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question