Search VB 2010

Sunday, December 15, 2013

Visual Basic Compare Two Treeviews and return differences

Visual Basic 2010 - Compare Two Strings and return differences and matches

vb2010 compare strings and return differences
VB2010 Compare Strings in Collections

Collections as an Alternative to Arrays

Visual Studio 2010
Although collections are most often used for working with the Object Data Type, you can use a collection to work with any data type. In some circumstances, it can be more efficient to store items in a collection than in an array.

If you need to change the size of an array, you must use the ReDim Statement (Visual Basic). When you do this, Visual Basic creates a new array and releases the previous array for disposal. This takes execution time. Therefore, if the number of items you are working with changes frequently, or you cannot predict the maximum number of items you need, you might obtain better performance using a collection.

A collection, which does not have to create a new object or copy existing elements, can handle resizing in less execution time than an array, which has to use ReDim. But if the size does not change, or changes only rarely, an array is likely to be more efficient. As always, performance is highly dependent on the individual application. It is often worth your time to try both an array and a collection.

This Example

How to compare two Treeviews in VB2010
How to return the differences between two Treeviews


- Create Visual Basic 2010 Windows Application Project
- On Form1, place two tree views and two textboxes and one button

Visual Basic Online Course
Visual Basic 2010 Compare Strings from Treeview
How does it work ?
- Store the Treeview1 [TRV1] nodes into Textbox, and the same with Treeview2 [TRV2]
- How many strings [Lines] in each Textbox

  • We want to find where both Textboxes is different and where both Textboxes is match to one another. For example, differences are :
- TRV1 has an extra string [Southern American]
- TRV2 node string [Africa] is different from TRV2 node string [African]

Steps to accomplish this task :

Download example from Mediafire
Extended work :
You can easily extract any Database tables, columns Schema into a treeview control, and you can also using this example compare two tables or two columns in a Database using this example as well.

You can use ListViews or ComboBoxes or ListBoxes instead of the Treeview control, I used the treeview control because it's always tricky to work with. Using other controls that store strings in Collection format would be so easy, even much easier than using Treeviews.

Another Treeview Examples

Expand and Collapse two treeviews at the same time according to one another even if they both don't have the same nodes names. Expand TreeView1[TRV1] node when TreeView2 [TRV2] node is expanded or collapsed.

TreeView Example : Change the node font

TreeView Example : Add a photo (icon) to the TreeView
1) Add ImageList from the ToolBox
2) Add 2 photos to the ImageList1 [From properties, Collection], for example :
- Photo1.Png (Index by default is Zero 0), this will be the Parent icon
- Photo2.Png (Index by default is One 1), this will be the first child icon
3) Code to display image/Icon in the Tree View :

Here are some online Visual Basic lessons and courses :


  1. 彼らのラップトップを保護して アシストのそれである 簡単 個人 に それを作る 周り 1 つから 配置
    を新しい。少ないお金であなた 可能性 最新のデザイン 可能性があります 高から作られた 。ハンド ・ バッグ、トート
    バッグ、ラップトップ バッグは 女の子人 は かなり忙しい 彼らのキャリアを。彼らは を特定 が
    人気 と 男性と女性。デザイナー
    ハンドバッグ できます 広いと広々 としました。

    Feel free to surf to my blog post アウトレット

  2. MFC Swe3tSunny Private Show video 01.02.2014

    Files size: 140.99M

    Extra search tags:
    mfc Swe3tSunny true private,
    mfc Swe3tSunny private show,
    Swe3tSunny mfc video,
    mfc Swe3tSunny recorded private show,

  3. 格安デザイナー バッグ が簡単に 利用 で割引 価格タグ。 あります いくつか まれな発見 バザーまたは 商品。

    my site DAMIR AZUR ダミエ・アズール

  4. Nowadays, there are many companies which offer healthy plus nutritious foods for
    infant. 1) Freezer Expiration Times Depending on where your own breast milk is usually stored
    includes a lot regarding just how long you can maintain it.
    Herbs - The right supplement can in fact improve your breast size by a full
    1 to 3 cups.

    My website; brestrogen cream price in pakistan

  5. Well for one, you can stop reading articles on
    the way to forge a shiny happy friendship along with your ex girlfriend.
    If you possess a neck massager, you'll be able to rub it up and along the
    neck or even in circles. They're important since they'll assistance to loosen the

    Check out my weblog ... Own Business News

  6. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Online Training from India. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
    JavaScript Online Training from India


Visual Basic Online Course

Visual Basic Courses - Share