Link to home
Start Free TrialLog in
Avatar of brettawv
brettawv

asked on

ExtendedDataGrid datasource problem

I am trying to use the third party extendeddatagrid component.  I am using this with vb.net.  I have it working succesfully with an IList, but I am unable to get it to work with an oledb datasource.  It doesn't seem my datasource no matter what I try.  What am I missing?  Any help would be greatly appreciated.  Here is the code I'm using under button1 that works:

Dim SqlString As String

        Dim DS As New DataSet
        Dim ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\awv binder\DATA\extdatgrid.mdb"
        Dim MyConn As OleDb.OleDbConnection = New OleDb.OleDbConnection(ConnStr)

        SqlString = "SELECT * From customer"

        Dim MyDataAdapter As New OleDb.OleDbDataAdapter(SqlString, MyConn)

        MyDataAdapter.Fill(DS, "customer")

        Dim c1 As New Customer

        c1.Name = DS.Tables("customer").Rows(0).Item("Name")
        c1.Importance = DS.Tables("customer").Rows(0).Item("Importance")
        c1.Description = DS.Tables("customer").Rows(0).Item("Description")

        Dim cust() As Customer = {c1}
        ExtendedDataGrid2.DataSource = cust

        Dim t1 As ProgressBarColumnControl = New ProgressBarColumnControl
        Dim t2 As MultiLineTextBox = New MultiLineTextBox

        Dim ts1 As Leadit.ExtendedDataGrid.ExtendedDataGridTableStyle = New Leadit.ExtendedDataGrid.ExtendedDataGridTableStyle

        ts1.MappingName = ExtendedDataGrid2.DataSource.GetType.Name

        Dim NameCol As DataGridTextBoxColumn = New DataGridTextBoxColumn
        NameCol.MappingName = "Name"
        NameCol.HeaderText = "Name"
        NameCol.Width = 75
        NameCol.ReadOnly = True
        ts1.GridColumnStyles.Add(NameCol)

        Dim ImportanceCol As Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn = New Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn
        ImportanceCol.Control = t1.GetType()
        ImportanceCol.MappingName = "Importance"
        ImportanceCol.HeaderText = "Importance"
        ImportanceCol.Width = 75
        ts1.GridColumnStyles.Add(ImportanceCol)

        Dim DescriptionCol As Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn = New Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn
        DescriptionCol.Control = t2.GetType()
        DescriptionCol.MappingName = "Description"
        DescriptionCol.HeaderText = "Description"
        DescriptionCol.Width = 200
        'DescriptionCol.ReadOnly = True
        ts1.GridColumnStyles.Add(DescriptionCol)

        ts1.PreferredRowHeight = 40
        ExtendedDataGrid2.TableStyles.Add(ts1)

Here is the code under button1 that doesn't work:

Dim SqlString As String

        Dim DS As New DataSet
        Dim ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\awv binder\DATA\extdatgrid.mdb"
        Dim MyConn As OleDb.OleDbConnection = New OleDb.OleDbConnection(ConnStr)

        SqlString = "SELECT * From customer"

        Dim MyDataAdapter As New OleDb.OleDbDataAdapter(SqlString, MyConn)

        MyDataAdapter.Fill(DS, "customer")

        Dim c1 As New Customer

        c1.Name = DS.Tables("customer").Rows(0).Item("Name")
        c1.Importance = DS.Tables("customer").Rows(0).Item("Importance")
        c1.Description = DS.Tables("customer").Rows(0).Item("Description")

        'Dim cust() As Customer = {c1}
        ExtendedDataGrid2.DataSource = DS
        ExtendedDataGrid2.DataMember = "customer"

        Dim t1 As ProgressBarColumnControl = New ProgressBarColumnControl
        Dim t2 As MultiLineTextBox = New MultiLineTextBox

        Dim ts1 As Leadit.ExtendedDataGrid.ExtendedDataGridTableStyle = New Leadit.ExtendedDataGrid.ExtendedDataGridTableStyle

        ts1.MappingName = "customer"
        'ExtendedDataGrid2.DataSource.GetType.Name()

        Dim NameCol As DataGridTextBoxColumn = New DataGridTextBoxColumn
        NameCol.MappingName = "Name"
        NameCol.HeaderText = "Name"
        NameCol.Width = 75
        NameCol.ReadOnly = True
        ts1.GridColumnStyles.Add(NameCol)

        Dim ImportanceCol As Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn = New Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn
        ImportanceCol.Control = t1.GetType()
        ImportanceCol.MappingName = "Importance"
        ImportanceCol.HeaderText = "Importance"
        ImportanceCol.Width = 75
        ts1.GridColumnStyles.Add(ImportanceCol)

        Dim DescriptionCol As Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn = New Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn
        DescriptionCol.Control = t2.GetType()
        DescriptionCol.MappingName = "Description"
        DescriptionCol.HeaderText = "Description"
        DescriptionCol.Width = 200
        'DescriptionCol.ReadOnly = True
        ts1.GridColumnStyles.Add(DescriptionCol)

        ts1.PreferredRowHeight = 40
        ExtendedDataGrid2.TableStyles.Add(ts1)

Please Help!

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brettawv
brettawv

ASKER

Sorry I've only been using vb.net for a couple of months.  Can you give me an example.
I set it up through the forms designer and it still doesn't work.
OK I got it to work, however it doesn't show up until I click on a grid cell.  Is there a way to have them show up when the grid is filled.