Options

How to populate a vb.net DataGridView control

jwilderjwilder Member Posts: 263
edited 2010-07-07 in NAV Three Tier
I have a page called Customer List which lists the No. and Name fields. I have published the Page through Business Web Services. I would now like to show the Customer Records in a vb.net DataGridView Control.

I have a Project started that references the Web Services so I have access to the Read, ReadMultiple Functions etc...

Can someone provide me with some documentation on how to do this. I am a bit confused on how many records to read and display plus what if someone does a Ctrl Home or Ctrl End or Page Down or Page Up. I basically do not know how to use the DataFlexGrid control with a web service.

Comments

  • Options
    ara3nara3n Member Posts: 9,255
    I think you will have many more responses if you ask this in a .NET forum.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    yukonyukon Member Posts: 361
    Hi jwilder,

    See my sample code. I link with customer ws and datagrid view. But if you want to control page up and page down you need to do a lot of things. If you want to know go to http://vbcity.com/
    ' ''Connect to WS service
            Dim service As New CustomerList_Service()
            service.UseDefaultCredentials = False
            service.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS Singapore Pte. Ltd/Page/CustomerList"
            service.Credentials = New NetworkCredential("administrator", "admin", "")
    
            ' ''Filter Customer 
            Dim filterArray As New List(Of CustomerList_Filter)()
            Dim CustFilter As New CustomerList_Filter()
            CustFilter.Field = CustomerList_Fields.No
            CustFilter.Criteria = ""
            filterArray.Add(CustFilter)
    
            ' ''Binding Customer List
            Dim CustLst As CustomerList() = service.ReadMultiple(filterArray.ToArray(), Nothing, 100)
            DataGridView1.DataSource = CustLst
    

    1. Create DataGrid View in your vb.net form.
    2. DataGrid View bind with your webservice. And then copy and past my code.

    Best Regards,
    Yukon
    Make Simple & Easy
Sign In or Register to comment.