Google Groups Home
Help | Sign in
DataGridView and a data.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Tim Riley  
View profile
 More options Oct 24 2007, 11:05 am
From: "Tim Riley" <ril...@gmail.com>
Date: Wed, 24 Oct 2007 11:05:25 -0400
Local: Wed, Oct 24 2007 11:05 am
Subject: DataGridView and a data.
Hi,
I'm trying to bind a DataGridView to a DataSet that I am creating
through code. However when I try to create the DataSet my app dies on
my. This is extremely tough for me to debug because my app is hosted
in another program (AutoCAD) and it raises an memory error and crashes
AutoCAD, with no .NET exceptions. Below is the code I'm using to
create the dataset. Can anyone give me any tips one what I'm doing
wrong? It would be greatly appreciated.

code:

class completebom:
        public ds as System.Data.DataSet

        def constructor():
                pass

        def MakeDataTables():
                MakeBomTable()

        def MakeBomTable():
                dt as System.Data.DataTable = System.Data.DataTable("ebom")

                //Create the Qty Column
                colQty as System.Data.DataColumn
                colQty.DataType = System.Type.GetType("System.Int32")
                colQty.ColumnName = "qty"
                colQty.Caption = "Qty"
                colQty.ReadOnly = false
                colQty.Unique = false
                dt.Columns.Add(colQty)

                //Create the CatalogNo Column
                colCat as System.Data.DataColumn
                colCat.DataType = System.Type.GetType("System.String")
                colCat.ColumnName = "catalogno"
                colCat.Caption = "Catalog No."
                colCat.ReadOnly = false
                colCat.Unique = true
                dt.Columns.Add(colCat)

                //Create the PartNo Column
                colPart as System.Data.DataColumn
                colPart.DataType = System.Type.GetType("System.String")
                colPart.ColumnName = "partno"
                colPart.Caption = "Part No."
                colPart.ReadOnly = false
                colPart.Unique = true
                dt.Columns.Add(colPart)

                //Create the Description Column
                colDesc as System.Data.DataColumn
                colDesc.DataType = System.Type.GetType("System.String")
                colDesc.ColumnName = "description"
                colDesc.Caption = "Description"
                colDesc.ReadOnly = false
                colDesc.Unique = false
                dt.Columns.Add(colDesc)

                //Create the Length Column
                colBlen as System.Data.DataColumn
                colBlen.DataType = System.Type.GetType("System.Single")
                colBlen.ColumnName = "blength"
                colBlen.Caption = "Length"
                colBlen.ReadOnly = false
                colBlen.Unique = false
                dt.Columns.Add(colBlen)

                //Create the Width Column
                colBwid as System.Data.DataColumn
                colBwid.DataType = System.Type.GetType("System.Single")
                colBwid.ColumnName = "bwidth"
                colBwid.Caption = "Width"
                colBwid.ReadOnly = false
                colBwid.Unique = false
                dt.Columns.Add(colBwid)

                //Create the Remark Column
                colRem as System.Data.DataColumn
                colRem.DataType = System.Type.GetType("System.String")
                colRem.ColumnName = "remark"
                colRem.Caption = "Remark"
                colRem.ReadOnly = false
                colRem.Unique = true
                dt.Columns.Add(colRem)

                //Create the Revision Column
                colRev as System.Data.DataColumn
                colRev.DataType = System.Type.GetType("System.String")
                colRev.ColumnName = "revision"
                colRev.Caption = "Revision"
                colRev.ReadOnly = false
                colRev.Unique = false
                dt.Columns.Add(colRev)

                ds.Tables.Add(dt)

From there I am trying to bind the dataset to a DataGridView via code like this:

namespace ks_ebom

import System
import System.Drawing
import System.Windows.Forms
import System.Data

partial public class frm_ebom:

        bomParts as int = 1
        public dbinter = externaldatabase()
        public combom as completebom

        public def constructor():
                //
                // The InitializeComponent() call is required for Windows Forms
designer support.
                //
                InitializeComponent()
                combom.MakeBomTable()
                self.dgvMainBom.DataSource = combom.ds


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rodrigo B. de Oliveira  
View profile
 More options Oct 24 2007, 3:04 pm
From: "Rodrigo B. de Oliveira" <rodrigobam...@gmail.com>
Date: Wed, 24 Oct 2007 16:04:24 -0300
Local: Wed, Oct 24 2007 3:04 pm
Subject: Re: DataGridView and a data.
On 10/24/07, Tim Riley <ril...@gmail.com> wrote:

> ....
> partial public class frm_ebom:

>         bomParts as int = 1
>         public dbinter = externaldatabase()
>         public combom as completebom

I dont see where you actually create the completebom instance. Maybe you meant:

          public combom = completebom()

?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Riley  
View profile
 More options Oct 24 2007, 4:02 pm
From: "Tim Riley" <ril...@gmail.com>
Date: Wed, 24 Oct 2007 16:02:12 -0400
Local: Wed, Oct 24 2007 4:02 pm
Subject: Re: DataGridView and a data.
Rodrigo,

Thanks for pointing it out. I forgot to post a reply to this post
stating that I had corrected the problem. latexer from the IRC channel
was kind enough to help me out.

Thanks again for the reply.

Tim

On 10/24/07, Rodrigo B. de Oliveira <rodrigobam...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google