473,785 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridViewChe ckbox Column and TabControl

1 New Member
Hi All,

I'm relatively new to vb .net and am probably making a simple mistake and would appreciate any help.

I have a tab control with 4 tabs. Each tab has a DataGridView and I'm populating all 4 of them from a SQL Server db via code. The data comes from multiple tables via a UNION.

The leftmost column in each DataGridView should be a checkbox which I'm creating like this:

Dim grdCheckBoxColu mn As New DataGridViewChe ckBoxColumn
MyGrid.Columns. Add(grdCheckBox Column)

Then I execute my SQL commands. I had trouble making the checkbox checked/unchecked directly from the sql query so I kludged it by making column(1) a "*" if that row should be checked or a "" if it shouldn't and then running this:

For I = 0 To (MyGrid.RowCoun t - 1)
If MyGrid.Rows(I). Cells(1).Value = "*" Then
MyGrid.Rows(I). Cells(0).Value = true
End If
Next

This works fine for the Grid on Tab1 but doesn't work for the other grids. The funny thing is that I can set the other columns in the other grids but not the checkbox. I set the column to Read/write like this:

MyGrid.Columns( 0).ReadOnly = False
MyGridCheckBoxC olumn.ReadOnly = False

Any help would be appreciated.

Trakk77
Jun 15 '07 #1
1 2316
thewingedlion
1 New Member
you can bind a datagridviewche ckbox control directly to the database without this workaround, in this case checked would be = 0 and any thing else would be unchecked, further more you can define what value for checked and what value for unchecked by using truevalue and falsevalue properties of the control.

I'm not sure what're trying to do, however if you need any further assistance please don't hesitate to contact me.
Aug 29 '07 #2

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

Similar topics

5
18511
by: Tamir Khason | last post by:
How be able to manage more deeply UI of TabControl and TabPage For example - I want to manage border color, change color of TabPage reef, eliminate spaces from both sides of the reef, so I bould custom control that inherit all information from TabPage, but how to access those properties, not supported by standart interface??? Thank you
3
4029
by: Edward Mostrom | last post by:
I have 2 tables that have a relation between them. The parent table also has an expression in a column that sums the values in the child table. Both tables are hooked up to datagrids. Everything seems to work fine as far as adding and changing rows in the child table. But if I delete a row in the child table that has a value in it, the parent table continues to have a total that includes the deleted child row... even after calling...
1
1118
by: John | last post by:
Hi, I have a datagrid with 3 columns. I use buttons to set the visible property of each column to true or false depending on which column I need to see, creating a TabControl effect. The only problem is when I come to save the data, the FindControl method won't pick up any controls in columns where the visible property is set to false, which means I can only save data in the 1 column I can see. Does anybody know of a way around this?
2
2371
by: Patrick McGuire | last post by:
I want to place a tabControl with almost identical properties on several forms. I think the best way is to define a UserControl that inherits System.Windows.Forms.TabControl, and place all my controls on it. The problem is that I don't know how to bring up the graphical design interface for the TabControl. I suppose I COULD just design it as a UserControl and place a TabControl on it, but that seems a bit... inelegant (I'm going to...
9
3458
by: Michael Turner | last post by:
Hi Guys Having problem with the tab control, I need to set the background color to something different than the standard, I have found code on the web and now can redraw the tabpage buttons so the are set to the right color, I can obviously change the tabpage colour but I am left with a grey top edge(Where there are no buttons) when the background of the form is changed any ideas on what I can do? Mike.
5
3352
by: Zadkin | last post by:
Does anyone know, if it's possible to set the orientation of the tabpagebuttons to horizontal instead of vertical when the alignment property of my tabcontrol is set to left or right? Thanks in advance Zadkin
0
2745
by: tramesh2007 | last post by:
I am using datagridviewcheckbox column in datagridview. I have a probelm for clicking checkbox column. The problem is, On datagrid_CellMouseClick event, for clicking checkbox when getting value(selected/not selected) for checkbox column for this event. The checkbox value is null. How can i get checkbox value(selected/not selected) using datagridview?
1
3459
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all In a Visual Studio 2005 C# project, I have a simplest tabcontrol with two tabpages. When I set tab control's Alignment property to Right, tab texts (captions) disappear. Does anybody know how to fix this? I tried this on two computers, at work and at home, both with Windows XP with latest service packs, and Framework 2.0 and 3.0 with latest SP.
0
1420
by: bertie78 | last post by:
Hi all, New poster here! I'm having some difficulty updating a tabcontrol cross-threads. The general idea is : the main thread is the owner of the tab control and the form controls. However, due to the vast amount of data to populate listviews within the tabs, I have created a worker thread (an implementation of a BackgroundWorker) to form the data and populate a tabcontrol 'offline', so that it doesn't interfer with (i.e freeze) the UI. ...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8972
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.