Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 22nd, 2007, 12:35 AM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Paulsburbon
Default Datagridview question

Hello, I'm having trouble getting a datagridview to do exactly what I want and can't get any answers from other forums. Hoping someone could help me out.

My datagridview datasource is from a linq query. I want to put in a comboBox that looks up a value in as a column in the datagridView. I'm having no success at all. I can get just the text box columns of the ID feild and the data or I get no data and the comboBox columns. Maybe someone can just point me in the right direction? I've been researching and trying different things for days now.

Thanks so much for your time.

Paul

 
Old August 22nd, 2007, 04:07 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Could you clarify?

"I want to put in a combo box"
In the grid? In the form? In a different form of the same app?
(I think you mean in the grid.)

How are you changing the grid to get the two different situations?
 
Old August 22nd, 2007, 04:16 PM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Paulsburbon
Default

Brian Thank you so much for replying!!!

The combo box goes in the grid.... At least I would like it to. I'm upgrading an access database where to do master - detail the detail was in a grid and it was really easy to throw in a lookup combo box and would like to keep it the same for the users...

I use a linq query to get items an add them to a node in a treeview... then when the user selects the node I want it fill in the grid with the details... but with one column I need it to be a drop down list and another column I need a checkbox.. here is the code:

Code:
Private Sub TreeView1_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
        Try
            If e.Node.Text.Contains("a") Or _
                e.Node.Text.Contains("e") Or _
                e.Node.Text.Contains("i") Or _
                e.Node.Text.Contains("o") Or _
                e.Node.Text.Contains("u") Then

            Else

                Dim SelectedClaimNumber As Integer = CInt(e.Node.Text)
                ToolStripStatusLabel1.Text = "Claim Number " & SelectedClaimNumber
                ToolStripStatusLabel3.Text = "Notes"

                Dim LineItems = From LI In db.ClaimLineItems _
                                Where LI.ClaimNumber = SelectedClaimNumber _
                                Select LI


                With DataGridView1
                    .DataSource = LineItems
                    .Columns(0).Visible = False
                    .Columns(1).Visible = False
                    .Columns(4).Visible = False
                    .Columns(12).Visible = False
                    .Columns(13).Visible = False
                    .Columns(14).Visible = False
                    .Columns(15).Visible = False
                    .Columns(16).Visible = False
                    .Columns(17).Visible = False
                    .Columns(18).Visible = False
                    .Columns(19).Visible = False
                    .Columns(20).Visible = False
                    .Columns(21).Visible = False
                End With

                Dim ClaimNotes = From CN In db.ClaimNotes _
                                 Where CN.ClaimNumber = SelectedClaimNumber _
                                 Select CN

                DataGridView2.DataSource = ClaimNotes
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub


This is the bare bones code that works but one of the columns VendorId I want to lookup vendorname in the vendor table. Is that clear enough?

I also want to know if I'm conducting myself the correct way in these forums. I find that I don't get answers like other questions and maybe there is something I don't know about that I'm doing to cause that. Thanks!!

Paul






Similar Threads
Thread Thread Starter Forum Replies Last Post
datagridview help manius VB Databases Basics 1 January 27th, 2008 02:44 AM
datagridview thirumalai ASP.NET 1.0 and 1.1 Professional 1 April 7th, 2007 03:35 AM
DataGridView akumarp2p C# 2005 1 December 30th, 2006 12:40 PM
Need Help with datagridview maximus101 VB Databases Basics 2 September 19th, 2006 10:49 AM
datagridview ScottSheck Visual Basic 2005 Basics 0 June 14th, 2006 11:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.