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
.NET ProgrammingVisual Basic Classic
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")

        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")


        Me.DataGrid1.DataSource = workTable


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 9 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 9 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004