Solved

.net datagridview

Posted on 2013-11-26
2
365 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This video discusses moving either the default database or any database to a new volume.

747 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

13 Experts available now in Live!

Get 1:1 Help Now