FR
Franck
June 22, 2004 06:50 AM UTC
Hello,
Do you found a solution to your problem. I have the same thing.
Thanks for your answer if any
Woodstock
>Hi, Im having this piece of code, but when i sort my datagrid the SelectedIndex seems not to be right anymore.
>
>I found here some code but i dont know where to place this code.
>
>[code]
>''Declare variabelen
> Dim ds As New DataSet
> Dim dt As New DataTable
> Dim columnFullName, columnAdres, columnPostcode, columnStraat As DataColumn
>
> Dim row As DataRow
>
> Function fillList()
>
> ''connect to outlook
> '' Create Outlook application.
> Dim oApp As Outlook.Application = New Outlook.Application
>
> '' Get namespace and Contacts folder reference.
> Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
> Dim cContacts As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
> Dim oCount = cContacts.Items.Count
>
> Dim contact
>
> dt.TableName = "contactPersonen"
>
> ''Column FullName
> columnFullName = New DataColumn
> columnFullName.DataType = System.Type.GetType("System.String")
> columnFullName.ColumnName = "Naam"
> columnFullName.Caption = "Naam"
> dt.Columns.Add(columnFullName)
>
> ''Column Adres
> columnAdres = New DataColumn
> columnAdres.DataType = System.Type.GetType("System.String")
> columnAdres.ColumnName = "Adres"
> columnAdres.Caption = "Adres"
> dt.Columns.Add(columnAdres)
>
> ''Columns Postcode
> columnPostcode = New DataColumn
> columnPostcode.DataType = System.Type.GetType("System.String")
> columnPostcode.ColumnName = "Postcode"
> columnPostcode.Caption = "Postcode"
> dt.Columns.Add(columnPostcode)
>
> ''Columns Plaats
> columnStraat = New DataColumn
> columnStraat.DataType = System.Type.GetType("System.String")
> columnStraat.ColumnName = "Plaats"
> columnStraat.Caption = "Plaats"
> dt.Columns.Add(columnStraat)
>
> ''Place all the items in the listbox.
> For Each contact In cContacts.Items
>
> row = dt.NewRow
> row.Item("Naam") = contact.FullName
> row.Item("Adres") = contact.BusinessAddressStreet
> row.Item("Postcode") = contact.BusinessAddressPostalCode
> row.Item("Plaats") = contact.BusinessAddressCity
> dt.Rows.Add(row)
>
> Next
>
> DataGrid1.DataSource = dt
> DataGrid1.AllowSorting = True ''Data can be ordered by name
> DataGrid1.PreferredColumnWidth = 308 ''Standaard breedte van de columns
> DataGrid1.SetDataBinding(dt, "") ''Datagrid laten vullen
>
> ''Clear all
> oApp = Nothing
> oNS = Nothing
> cContacts = Nothing
> contact = Nothing
>
> End Function ''Function to fill the datagrid
>[/code]