473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

DatagridView checkbox error

54
Am using vb.net 2008 and sql2008 and I want to loop thru frmMovement.DataGridView1 and the checked rows shd get populated into frmMovementReceivedFiles.DataGridView2. But I used Cbool, Boolean.TryParse to convert the the checked value but I still get but still the error: "Conversion from string "" to type 'Boolean' is not valid"
The code is as follows. Or ss there anyway to loop thru the checkboxes and populate them in another DatagridView2?

Expand|Select|Wrap|Line Numbers
  1.  Dim ctr As Integer
  2.         frmMovementReceivedFiles.DataGridView2.Rows.Clear()
  3.         For ctr = 0 To frmMovement.DataGridView1.Rows.Count - 1
  4.             If frmMovement.DataGridView1.Rows(ctr).Cells("Column1").Value = True Then
  5.                 frmMovementReceivedFiles.DataGridView2.Rows.Add( _
  6.                frmMovement.DataGridView1.Rows(ctr).Cells(1).Value, _
  7.                 frmMovement.DataGridView1.Rows(ctr).Cells(2).Value, _
  8.                 frmMovement.DataGridView1.Rows(ctr).Cells(3).Value, _
  9.                 frmMovement.DataGridView1.Rows(ctr).Cells(4).Value)
  10.             End If
  11.         Next
  12.         If frmMovementReceivedFiles.DataGridView2.RowCount > 0 Then
  13.             frmMovementReceivedFiles.Show()
  14.         End If
Mar 1 '10 #1
2 2710
tlhintoq
3,525 Expert 2GB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Mar 1 '10 #2
tlhintoq
3,525 Expert 2GB
error: "Conversion from string "" to type 'Boolean' is not valid"
If frmMovement.DataGridView1.Rows(ctr).Cells("Column1 ").Value = True

Are you sure this value isn't a string? I would put a breakpoint here and double check what the actual value is
Mar 1 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rick Shaw | last post by:
Hi, I have a problem with the datagridview not refreshed when the application first appear on the screen. The datagridview display data from a table in the dataset. At the same time, I've added...
4
by: Hexman | last post by:
Hello All, I'd like to find out the best way to add a cb column to a dgv and process efficiently. I see at least two ways of doing it. ------------------------------- 1) Add a cb to the dgv,...
4
by: Annie | last post by:
hello guys, I am having a DataGridView control. The first column is a checkbox column. The users can select the checkbox column. I need to loop through the grid rows and get the checked...
2
by: =?Utf-8?B?VG9ueSBBLg==?= | last post by:
I have a datagridview on a Windows form where one of the columns is a checkbox. After checking or unchecking the checkbox I try to update the database. The following error appears ...
2
by: mrstrong | last post by:
Gday, I have a datagridview that I am creating the columns programatically which all seems to work fine. I have a couple of dropdown boxes, so I have set the editMode= EditOnEnter. Now my...
2
by: mrstrong | last post by:
Gday, Why would all my checkboxes inside a datagridview stop working (ie checked state not updating when user clicks) when the datagridview's editmode property is changed to "EditOnEnter"? It...
1
by: zacks | last post by:
Using VS 2005. I have an app that has a DataGridView control. This control has two columns, the first column is a standard TextBox, and the second column is a CheckBox. I am having difficulty...
1
by: QuickBooksDev | last post by:
VB.NET 2005 DataGridView Checkbox - Check Event need to know check status I would like to use the DataGridView Checkbox like a normal checkbox. When someone clicks on it I would expect that I...
8
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
If I populate a DataGridView with a query supplied at runtime, boolean fields render as a CheckBox instead of just a text rendering of '0' or '1'. That is nice sometimes, but I would like the...
0
by: =?Utf-8?B?S2lt?= | last post by:
Hi all I'm working with a column of checkbox in datagridview. I can mark the cells defalut false 1. time by set thristate to false and varpmode to false too => all the cell are default false...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.