troubleshooting Question

VB .NET 2003 Datatable trying to autosize column before assigning table to datagrid1.datasource

Avatar of mphillip85
mphillip85Flag for United States of America asked on
Visual Basic Classic.NET Programming
9 Comments1 Solution1784 ViewsLast Modified:
Here is my code below, what can I do to autosize the columns?

Dim workTable As DataTable
        Dim workCol As DataColumn
        Dim TableCell As DataTable
        Dim tempRow As DataRow
        Dim mySplash As New Splash
        Dim Counter As Integer = 0

        workTable = New DataTable("TrueUp_Reporting")
        mySplash.Show()
        Application.DoEvents()

        workTable.Columns.Add("Business Name")
        workTable.Columns.Add("LDC Account Number")
        workTable.Columns.Add("Rate Code")
        workTable.Columns.Add("Read Date", GetType(Date))
        workTable.Columns.Add("Therms", GetType(Double))
        workTable.Columns.Add("PGE Price", GetType(Double))
        workTable.Columns.Add("RDWD Est Price", GetType(Double))
        workTable.Columns.Add("RDWD Act Price", GetType(Double))

        Me.ProgressBar1.Minimum = 0
        Me.ProgressBar1.Maximum = Me.DS_TrueUpReporting.TrueUp_Reporting.Rows.Count

        For Counter = 0 To Me.DS_TrueUpReporting.TrueUp_Reporting.Rows.Count - 1

            Me.ProgressBar1.Value = Counter

            tempRow = workTable.NewRow

            tempRow(0) = Me.DS_TrueUpReporting.Tables("TrueUp_Reporting").Rows(Counter).Item("Name")




            workTable.Rows.Add(tempRow)
            Application.DoEvents()
        Next

        Me.DataGrid1.DataSource = workTable

        mySplash.Close()
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros