Solved

.net datagridview

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 2008 - SQL Timeout 9 34
C# LINQ ForEach() question 6 48
Groupbox Control ? 2 16
Where does legacy ASP.NET initialize language? 2 19
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

792 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