Getting the current data of a datagridview


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Getting the current data of a datagridview

  1. #1
    Join Date
    Mar 2008
    Location
    BELGIUM - East Flanders
    Posts
    174

    Getting the current data of a datagridview

    Hey,

    I need to get the current data from a grid for some live validation stuff that occurs when the content of a cell is changed. Is it possible to get this data without commiting it to the grid, or with doing that but without having to end the user edit?

    Cheers
    BN

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    If the grid is being fed from a database, which most grids are, you could work with the data directly using SQL. Is that what you mean?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Mar 2008
    Location
    BELGIUM - East Flanders
    Posts
    174
    No, the grid is not connected to any data source. The user manually fills in fields and then the data is used in a procedure.

    In the previouse version of the application a textbox was used for this purpouse, which allowed only one entry. That is the reason I'm now using a grid. (This is explanation fro why using the grid, not directrly rlated to my problem.)

    Cheers
    BN

  4. #4
    Join Date
    Mar 2008
    Location
    BELGIUM - East Flanders
    Posts
    174
    Hey,

    I found it

    Code:
            Private Sub dgvHashes_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) _
            Handles dgvHashes.EditingControlShowing
                AddHandler e.Control.KeyUp, AddressOf dgvHashes_CellKeyUP
            End Sub
    
            Private Sub dgvHashes_CellKeyUP(ByVal sender As Object, ByVal e As KeyEventArgs)
              ' Commiting the change  dgvHashes.CommitEdit(DataGridViewDataErrorContexts.CurrentCellChange)
    ' Setting the controls accoring to validation
                setAttackCp()
            End Sub

  5. #5
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Cool! I'm glad you came back and posted your solution.

    That isn't an approach I would have thought of.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. manual data binding with datagridview
    By manibest in forum .NET
    Replies: 1
    Last Post: 02-14-2008, 06:44 AM
  2. Replies: 3
    Last Post: 10-12-2007, 11:00 AM
  3. Data Service 2.0.0
    By zw_sea in forum Java
    Replies: 0
    Last Post: 05-28-2007, 01:23 AM
  4. convert old data files to current standards
    By Warren in forum VB Classic
    Replies: 4
    Last Post: 04-11-2003, 05:15 PM
  5. Data Junction Announces XML Junction 7.51
    By Tim Frost in forum xml.announcements
    Replies: 0
    Last Post: 04-02-2001, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center