PC Review


Reply
Thread Tools Rate Thread

DataGrid text box column

 
 
neil rowe
Guest
Posts: n/a
 
      6th Dec 2003
Hi all

How do I trap the click event of a standard datagrid text box column on a
windows form ?

Regards

Neil


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      6th Dec 2003
Hi,

You need to add a tablestyle to the grid. Add a handler to the
columns textbox click event.

Private Sub SetupGrid()

Dim ts As New DataGridTableStyle

ts.MappingName = dsInvoicesData.Tables(0).TableName



Dim colDescription As New DataGridTextBoxColumn

With colDescription

..MappingName = "Description"

..HeaderText = "Description"

..Width = 280

..NullText = ""

End With

AddHandler colDescription.TextBox.Click, AddressOf Me.HandlesDataColumnClick

Dim colQty As New DataGridTextBoxColumn

With colQty

..MappingName = "Quantity"

..HeaderText = "Qty"

..Width = 50

End With

Dim pd As System.ComponentModel.PropertyDescriptor =
cm.GetItemProperties()("Each")



Dim colEach As New DataGridTextBoxColumn(pd, "C")

With colEach

..MappingName = "Each"

..HeaderText = "Each"

..Width = 50

End With

Dim colPrice As New DataGridTextBoxColumn(pd, "C")

With colPrice

..MappingName = "Price"

..HeaderText = "Price"

..Width = 50

End With

ts.GridColumnStyles.Add(colDescription)

ts.GridColumnStyles.Add(colQty)

ts.GridColumnStyles.Add(colEach)

ts.GridColumnStyles.Add(colPrice)

dgInvoiceData.TableStyles.Add(ts)

ts = Nothing

colPrice = Nothing

colEach = Nothing

colQty = Nothing

colDescription = Nothing

End Sub

Private Sub HandlesDataColumnClick(ByVal sender As Object, ByVal e As
System.EventArgs)

MessageBox.Show("Click")

End Sub


Ken
------------------
"neil rowe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all
>
> How do I trap the click event of a standard datagrid text box column on a
> windows form ?
>
> Regards
>
> Neil
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid Column Text =?Utf-8?B?TGkgUGFuZw==?= Microsoft VB .NET 5 16th Dec 2005 04:58 AM
Text cut-off in column of DataGrid rpy@hotmail.com Microsoft Dot NET Compact Framework 1 22nd Mar 2005 12:34 AM
DataGrid Column By Text Mr.D Microsoft VB .NET 2 21st Oct 2004 11:11 AM
Datagrid Column Header Text Demetri Microsoft ASP .NET 0 21st Apr 2004 08:03 PM
Finding TEXT of DataGrid Column David Elliott Microsoft Dot NET Framework Forms 1 21st Aug 2003 01:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:41 AM.