Solved

.net datagridview

Posted on 2013-11-26
2
369 Views
Last Modified: 2013-11-27
I have a datagridview with 2 field in it. When I query a database for some reason it end up with more fields than I have selected and added to the grid.

Public Class InspectData
    Private Context As DataContext
    Private Sub InspectData_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'Connection settings
        Context = New DataContext(True)
        Using cf As New Util.ConnectionForm
            cf.ShowDialog()
            Context.Connect(cf.Server, cf.PortNumber, cf.Partition, cf.UserName, cf.Password)
        End Using

        Engine.Text = InspectStatus.engine.Text

        Engine.Text = "FD620DA00001"


        If String.IsNullOrEmpty(Engine.Text) Then
            Engine.Text = "Please Scan Engine Here."
        Else

            Dim location As String = "I"
            Dim columns = M_METPCols.M_ETDS + M_METPCols.M_EARL

            'retrieve engine scanned from engine master
            Dim troubles = Context.M_METP.RetrieveList(columns, M_METPExprs.M_EARL = "I")

            Engine.Text = "FD620DA00001"

            ' Display the result in the grid view
            Me.TroubleCodes.DataSource = troubles

        End If

    End Sub

End Class
list.png
0
Comment
Question by:MVLIS
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 39680195
There is the DataGridView.AutoGenerateColumns.  You need to set that to false, if you are defining your own columns.
0
 

Author Closing Comment

by:MVLIS
ID: 39680651
Thank you very much for your help.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net/SQL prevent a table from being deleted ever 7 34
Please explain "Multi-Tenant Services" 5 64
Host asp.net pages 5 25
SQL Login 17 40
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now