Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 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 February 16th, 2008, 06:09 AM
Registered User
Join Date: Feb 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding DateTimePicker to DatagridView

Hello Everyone,

I am using the code below to bind data to datagridview. The problem is I don't want to bind the DateBooked, ArrivalDate,& DepartureDate to a DataGridView Text Box. I wana bind them to a dateTimePicker so please I need someone to send me the source code in a simplest way because iam still beginner, so I can understand it well...Your earliest reply will be highly appreciate it.

Private Sub FillDataGridView()

        Dim da As New OleDbDataAdapter
        Dim ds As DataSet

            ds = New DataSet

            da.SelectCommand = New OleDbCommand
            da.SelectCommand.Connection = connDB.getConn
            da.SelectCommand.CommandType = CommandType.Text

            da.SelectCommand.CommandText = "Select Rooms.RoomNumber as [Room Number], RoomType.Description as [Room Type], " & _
            "RoomType.ratePerNight As [Price/Night], Booking.DateBooked As[Booked In], Booking.ArrivalDate as [Check In], " & _
            "Booking.DepartureDate As [Check Out], Booking.Status " & _
            "From Booking, Customers, Rooms, RoomType " & _
            "Where Customers.CustomerID = Booking.CustomerID " & _
            "and Booking.RoomNumber = Rooms.RoomNumber " & _
            "and Rooms.idType = RoomType.idType " & _
            "and Customers.Name = '" & cmbBoxSrch.Text & "'"

            da.Fill(ds, "Customers")
            da.Fill(ds, "Rooms")
            da.Fill(ds, "Booking")
            da.Fill(ds, "RoomType")

            DataGridView1.DataSource = ds
            DataGridView1.DataMember = "Customers"

            DataGridView1.DataSource = ds
            DataGridView1.DataMember = "Rooms"

            DataGridView1.DataSource = ds
            DataGridView1.DataMember = "Booking"

            DataGridView1.DataSource = ds
            DataGridView1.DataMember = "RoomType"

        Catch ex As OleDb.OleDbException
        End Try

    End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Builder 6 - DateTimePicker rowin C++ Programming 0 April 28th, 2006 08:54 AM
DateTimePicker with Two Forms hexOffender VB.NET 2002/2003 Basics 2 April 10th, 2006 03:32 PM
dateTimePicker sconineuk General .NET 0 March 7th, 2006 11:22 AM
adding my own combo box in datagridview drachx Pro Visual Basic 2005 0 January 27th, 2006 03:04 AM
DateTimePicker validating fongklem VS.NET 2002/2003 0 July 20th, 2005 09:17 AM

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