• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

Help with unbounding a Grid

Hello,

I am loading my grid with code in Part A, but when trying to save data entered in code in Part B I receive the following error:

Not supported when the grid is bound

on line: For x As Integer = 0 To C1NSN.Rows.Count - 1

How do you unbound the grid or fix this error?

Part A:

 Dim NSN As New DataSet
        NSN.ReadXml(Application.StartupPath + "\App_Data\Blank.xml")
        C1NSN.DataSource = NSN.Tables(0)



Part B:

    For x As Integer = 0 To C1NSN.Rows.Count - 1
                If CheckForNSNFix.Contains(C1NSN.Rows(x).ToString) Then
                    For Each xnLink As Xml.XmlNode In xdNSN.SelectNodes("/Root/NSNTable[NSN='" & C1NSN.Rows(x).ToString & "']")
                        NSN_ID = xnLink.SelectSingleNode("NSN_ID").InnerText
                        If NSN_ID <> "" Then
                            CD = NSN_ID
                            If u > 0 Then
                                num1 = num1 & "" & CD & ","
                            Else
                                num1 = CD & ","
                            End If
                            u = u + 1
                        End If
                    Next
                End If
            Next
0
vcharles
Asked:
vcharles
  • 6
  • 3
  • 2
1 Solution
 
vcharlesAuthor Commented:
Help!
0
 
CodeCruiserCommented:
Is C1NSN a DataGridView?
0
 
vcharlesAuthor Commented:
C1NSN is from componentOne (TrueDBGrid), but I thinnk the solution for the DataGridView would also apply since they have many similar features.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
CodeCruiserCommented:
They are different in this case. What happens if you change

For x As Integer = 0 To C1NSN.Rows.Count - 1

to

For x As Integer = 0 To C1NSN.RowCount
0
 
vcharlesAuthor Commented:
Currently do not have access to my application, I will try it later and get back to you.
Thanks.
0
 
vcharlesAuthor Commented:
Hi,
I still receive error message "Not supported when the Grid id bound"
0
 
CodeCruiserCommented:
On same line?
0
 
vcharlesAuthor Commented:
Yes.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
If you step through the code, what is the value of C1NSN.Rows.Count?  Alternately, you could do something like...
     Dim x as Integer = C1NSN.Rows.Count
...to see the value
0
 
Paul MacDonaldDirector, Information SystemsCommented:
Also, what if you try:

   ...
     For x As Integer = 0 To C1NSN.Splits(0).Rows.Count - 1
   ...
0
 
vcharlesAuthor Commented:
Hi,

Post with C1NSN.RowCount  works, modified to C1NSN.RowCount  - 1

Thank you for all you comments.

Victor
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now