1
Answer

How to bind data to multiple columns of WPF listview from VB.net code

naveen

naveen

14y
11.5k
1
Hi all

    Im using VB.net and WPF .

In a WPF page ,i have created a listview to show records added.

In XAML,i have

 <ListView Margin="172,222,276,213" Name="ListViewDonotCall">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="Name" Width="150" />
                        <GridViewColumn Header="Mobile Number" Width="150" />
                    </GridView>
                </ListView.View>
        </ListView>

But in vbcode i need to bind datas to its items

i have tried like
--------------------------------------------------------
 i = ListViewDonotCall.Items.Count
        ListViewDonotCall.Items.Add(TextBoxName.Text.ToString())
---> ListViewDonotCall.Items(i).SubItems.Add(TextBoxMobileNo.Text.ToString())
        i = i + 1
---------------------------------------------------------
But in the arrow line ,it gives error,sub item error

How can i bind data to multiple columns

Thanks in advance

Naveen

Answers (1)