Solved

.net datagridview

Posted on 2013-11-26
2
381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

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:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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 we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

615 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