Thanks a lot Tamiz

On Tue, Oct 21, 2008 at 11:38 AM, sallushan <[EMAIL PROTECTED]> wrote:

>
> The link you have given works fine, but the following is better,
>
> Private Sub DataGridView1_MouseDown(ByVal sender As Object, ByVal e As
> System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown
>    If e.Button = Windows.Forms.MouseButtons.Right Then
>        Dim ht As DataGridView.HitTestInfo
>        ht = Me.DataGridView1.HitTest(e.X, e.Y)
>        If ht.Type = DataGridViewHitTestType.Cell Then
>            Me.DataGridView1.CurrentCell =
> Me.DataGridView1(ht.ColumnIndex, ht.RowIndex)
>        End If
>    End If
> End Sub
>
> Here we have used the "CurrentCell" property.
>
> Now comming to your question regarding the ContextMenu. You can define
> ContextMenu for the whole DataGridView using its "ContextMenuStrip"
> property, but then you will get the Menu whenever you right click
> anywhere on DataGridView (on column header, row header, etc.). Since
> we need to show the menu when user right clicks on a Row, therefore we
> can define the ContextMenu for Row. Use the "ContextMenuStrip" member
> of "RowTemplate" property of DataGridView control.
>
> Note that in DataGridView control we can define a different
> "ContextMenuStrip" for individual Columns/Rows/Cells. By defining the
> ContextMenuStrip in RowTemplate makes that ContextMenu available for
> all rows.
>
> Reagards,
> Arsalan Tamiz
>
> On Oct 20, 6:59 pm, Karthizen <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > Hi,
> >
> > I have some 'n' number of records in a datagridview.  I need to right
> > click on a row to pop up a context menu, then I need to click a
> > particular menu to display the contents of the row.  Can you please
> > give me some suggestions on how to solve it?
> >
> > I found this linkhttp://
> forums.microsoft.com/MSDN/ShowPost.aspx?PostID=196286&SiteID=1
> > which helps to right click & display the contents of a row.  However I
> > need to first display the context menu and after that I need to
> > populate the row contents.
> >
> > Regards,
> > Karthizen
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment

You may subscribe to group Feeds using a RSS Feed Reader to stay upto date 
using following url  

<a href="http://feeds.feedburner.com/DotNetDevelopment";> 
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---

Reply via email to