Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Data Filling and Handelling in VB.NET using DataGrid

Data Filling and Handelling in VB.NET using DataGrid

Scheduled Pinned Locked Moved Visual Basic
csharpcssdatabasecom
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thangaraj P V
    wrote on last edited by
    #1

    Hi, Can anyone tell me is this possible..... I want to fill the DataGrid. I have 5 columns selected in the Query using Joins from 2 Tables. I want to Fill the Datas in the Grid along with it, add 2 more columns to be added in the Grid, but the 2 added columns should be used as Date Picker. This is for VB.NET application. and it is a Very urgent task to Complete. pls help me out in doing this Task. (Note: I'm NEW to .NET) Thanx and Regards, Tthangaraj P.V. tthangarajpv@yahoo.com

    S R 2 Replies Last reply
    0
    • T Thangaraj P V

      Hi, Can anyone tell me is this possible..... I want to fill the DataGrid. I have 5 columns selected in the Query using Joins from 2 Tables. I want to Fill the Datas in the Grid along with it, add 2 more columns to be added in the Grid, but the 2 added columns should be used as Date Picker. This is for VB.NET application. and it is a Very urgent task to Complete. pls help me out in doing this Task. (Note: I'm NEW to .NET) Thanx and Regards, Tthangaraj P.V. tthangarajpv@yahoo.com

      S Offline
      S Offline
      Syed Abdul Khader
      wrote on last edited by
      #2

      Hi, There is a great sample for doing this in MSDN. I am just giving it. Imports System Imports System.Data Imports System.Windows.Forms Imports System.Drawing Imports System.ComponentModel ' This example shows how to create your own column style that ' hosts a control, in this case, a DateTimePicker. Public Class DataGridTimePickerColumn Inherits DataGridColumnStyle Private timePicker As New DateTimePicker() ' The isEditing field tracks whether or not the user is ' editing data with the hosted control. Private isEditing As Boolean Public Sub New() timePicker.Visible = False End Sub Protected Overrides Sub Abort(ByVal rowNum As Integer) isEditing = False RemoveHandler timePicker.ValueChanged, _ AddressOf TimePickerValueChanged Invalidate() End Sub Protected Overrides Function Commit _ (ByVal dataSource As CurrencyManager, ByVal rowNum As Integer) _ As Boolean timePicker.Bounds = Rectangle.Empty AddHandler timePicker.ValueChanged, _ AddressOf TimePickerValueChanged If Not isEditing Then Return True End If isEditing = False Try Dim value As DateTime = timePicker.Value SetColumnValueAtRow(dataSource, rowNum, value) Catch End Try Invalidate() Return True End Function Protected Overloads Overrides Sub Edit( _ ByVal [source] As CurrencyManager, _ ByVal rowNum As Integer, _ ByVal bounds As Rectangle, _ ByVal [readOnly] As Boolean, _ ByVal instantText As String, _ ByVal cellIsVisible As Boolean) Dim value As DateTime = _ CType(GetColumnValueAtRow([source], rowNum), DateTime) If cellIsVisible Then timePicker.Bounds = New Rectangle _ (bounds.X + 2, bounds.Y + 2, bounds.Width - 4, _ bounds.Height - 4) timePicker.Value = value timePicker.Visible = True AddHandler timePicker.ValueChanged, _ AddressOf TimePickerValueChanged Else timePicker.Value = value timePicker.Visible = False End If If timePicker.Visible Then DataGridTableStyle.DataGrid.Invalidate(bounds) End If End Sub Protected Overrides Function GetPreferredSize( _ ByVal g As Graphics, _ ByVal value As Object) As Size Return New Size(

      1 Reply Last reply
      0
      • T Thangaraj P V

        Hi, Can anyone tell me is this possible..... I want to fill the DataGrid. I have 5 columns selected in the Query using Joins from 2 Tables. I want to Fill the Datas in the Grid along with it, add 2 more columns to be added in the Grid, but the 2 added columns should be used as Date Picker. This is for VB.NET application. and it is a Very urgent task to Complete. pls help me out in doing this Task. (Note: I'm NEW to .NET) Thanx and Regards, Tthangaraj P.V. tthangarajpv@yahoo.com

        R Offline
        R Offline
        Ravi S V
        wrote on last edited by
        #3

        Go thru this link http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsdatagridcolumnstyleclasstopic.asp

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups