Grid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xp

    #1

    Grid

    I have a datagrid on my VB.Net form. I am trying to use
    the DblClick event of the grid, but when I run the program
    and double click on the grid, the event was not evoked.
    Why?

    Thanks
    xp
  • Ryan Byington

    #2
    RE: Grid

    I have experienced this as well. If you double click on the row or column
    headers, double click on a space where there are no cells or double click
    inbetween the cells when the cursor is just the arrow then the DataGrid
    will get this event. What I think happens when you double click in a cell
    is the DataGrid cell which in this case is probably a TextBox gets the
    double click event.

    One possible solution would be to set the DataGrid.TableS tyles property
    with a TableStyle that has the ColumnStyles property with
    DataGridTextBox Column for each column. With DataGridTextBox Column you can
    get a reference to the underlying textbox with the TextBox property. This
    might work something like the following:

    DataGrid dg = new DataGrid();
    TableStyle ts = new TableStyle();
    DataGridTextBox Column textColumn;

    for(int i=0; i<Number_Of_Col umns; i++) {
    textColumn= new DataGridTextBox Column();
    textColumn.Text Box.DoubleClick += new
    EventHandler(My DoubleClickEven tHandler);
    ts.ColumnStyles .Add(textColumn );
    }

    dg.TableStyles. Add(ts);

    Ryan Byington [MS]

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at
    http://www.microsoft.com/info/cpyright.htm

    --------------------[color=blue]
    >Content-Class: urn:content-classes:message
    >From: "xp" <gpdu@shaw.ca >
    >Sender: "xp" <gpdu@shaw.ca >
    >Subject: Grid
    >Date: Wed, 6 Aug 2003 15:52:52 -0700
    >Lines: 7
    >Message-ID: <04d601c35c6d$7 76f7650$a501280 a@phx.gbl>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="iso-8859-1"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    >Thread-Index: AcNcbXdvhEHy8bZ 2Q6KpwSaQyJEKWQ ==
    >Newsgroups: microsoft.publi c.dotnet.genera l
    >Path: cpmsftngxa06.ph x.gbl
    >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:103781
    >NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
    >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    >I have a datagrid on my VB.Net form. I am trying to use
    >the DblClick event of the grid, but when I run the program
    >and double click on the grid, the event was not evoked.
    >Why?
    >
    >Thanks
    >xp
    >[/color]

    Comment

    Working...