Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with unbounding a Grid

Posted on 2012-12-27
11
Medium Priority
?
271 Views
Last Modified: 2012-12-28
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
Comment
Question by:vcharles
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 

Author Comment

by:vcharles
ID: 38726710
Help!
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38726735
Is C1NSN a DataGridView?
0
 

Author Comment

by:vcharles
ID: 38726765
C1NSN is from componentOne (TrueDBGrid), but I thinnk the solution for the DataGridView would also apply since they have many similar features.
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 38726776
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
 

Author Comment

by:vcharles
ID: 38726789
Currently do not have access to my application, I will try it later and get back to you.
Thanks.
0
 

Author Comment

by:vcharles
ID: 38726950
Hi,
I still receive error message "Not supported when the Grid id bound"
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38727036
On same line?
0
 

Author Comment

by:vcharles
ID: 38727188
Yes.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38727908
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
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38727924
Also, what if you try:

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

Author Comment

by:vcharles
ID: 38728025
Hi,

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

Thank you for all you comments.

Victor
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question