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. Need help with datagridview problem!

Need help with datagridview problem!

Scheduled Pinned Locked Moved Visual Basic
databasehelpdebuggingquestion
1 Posts 1 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.
  • H Offline
    H Offline
    Hansduncan
    wrote on last edited by
    #1

    Could someone please help me out with this problem I have been struggling with this past week? Some background info: I am trying to insert new row(s) into a datagridview called "CustSalesOpportunityLineDataGridView" (that is databound to a table called "custsalesopportunityline" in a master-detail form that contains includes the header info as well). I have also created a generic product selection form that contains a datagridview called "ArticleDataGridView" that displays all the info and contains the filters that users need to efficiently search and filter out products. The dataset for the "ArticleDataGridView" is based on a view that I have created in the database. On the "ArticleDataGridView" I have created a column called "Select_Article" that is a DataGridViewCheckBoxColumn. (false value = 0, indeterminate = 0, true =1). If the users want to add a particular product to the SalesOpportunityLine datagridview they should be able to check the checkbox for each desired row and then click the AddAndContinueButton. The Select_Article checkbox column is the leftmost column of the datagridview. For each product that they have selected in the articledatagridview a new row in the "CustSalesOpportunityLineDataGridView" should be created and displayed as well as the articleID, name and Salesopportunityheaderid. Is the code below written correctly to: Test for the checkbox.checked=true on the first column of the datagridview Write values to the "CustSalesOpportunityLineDataGridView". Nothing happens when I run the code in debug..... Private Sub AddAndContinueButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddAndContinueButton.Click For Each dgvRow As DataGridViewRow In Me.ArticleDataGridView.SelectedRows If Me.ArticleDataGridView.Item(1, ArticleDataGridView.CurrentRow.Index).Value = 1 Then Dim dt As DataTable = Me.SalesOpportunity.Tables("custsalesopportunityline") Dim dtRow As DataRow = dt.NewRow() dtRow("Salesopportunityheaderid") = NewSalesOpportunity.SalesoppHeaderID dtRow("articleid") = dgvRow.Cells("ArticleIdDataGridViewTextBoxColumn").Value dtRow("work_articlename") = dgvRow.Cells("ProduktnavnDataGridViewTextBoxColumn").Value dt.Rows.Add(dtRow) End If Next End Sub

    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