Solved

ExtendedDataGrid datasource problem

Posted on 2004-04-22
4
323 Views
Last Modified: 2010-05-18
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!

0
Comment
Question by:brettawv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 10892486
I would try this through a test form in the designer, by creating an OleDbDataAdapter on the form, and doing it through the designer to see if it is possible, and then determining what the flow is to make that work.

Bob
0
 

Author Comment

by:brettawv
ID: 10892573
Sorry I've only been using vb.net for a couple of months.  Can you give me an example.
0
 

Author Comment

by:brettawv
ID: 10893160
I set it up through the forms designer and it still doesn't work.
0
 

Author Comment

by:brettawv
ID: 10893640
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.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question