473,397 Members | 2,028 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.

dataGridView2 is interferring with dataGridView1...

Hi,
I have dataGridView1 with a DataSource (categoriesBindingSource).
I didn't use the vs.net workbench to bind the second datagridview
(dataGridView2).
I used this code:

bindingSource1.DataSource = GetData("Select id, parent_id, name FROM
categories where parent_id = '" + dgData1 + "' and active = 1 order by
sort_order asc");
dataGridView2.DataSource = bindingSource1;
>From the Select statement, the columns are created on the fly in
dataGridView2.
I can't go to properties and create the columns I really want to have
since they are in the
Select statement. I can't make the Id column invisible (I want it
invisible because I only want the name column to show).

I need help in figuring out how to format the columns or gain control
over the columns generated on the fly by the Select statement in
dataGridView2 because right now it's not the way I want them.
Any help is appreciaed.
Thanks,
Trint

May 31 '07 #1
1 1558
On May 31, 7:40 am, trint <trinity.sm...@gmail.comwrote:
Hi,
I have dataGridView1 with a DataSource (categoriesBindingSource).
I didn't use the vs.net workbench to bind the second datagridview
(dataGridView2).
I used this code:

bindingSource1.DataSource = GetData("Select id, parent_id, name FROM
categories where parent_id = '" + dgData1 + "' and active = 1 order by
sort_order asc");
dataGridView2.DataSource = bindingSource1;
From the Select statement, the columns are created on the fly in

dataGridView2.
I can't go to properties and create the columns I really want to have
since they are in the
Select statement. I can't make the Id column invisible (I want it
invisible because I only want the name column to show).

I need help in figuring out how to format the columns or gain control
over the columns generated on the fly by the Select statement in
dataGridView2 because right now it's not the way I want them.
Any help is appreciaed.
Thanks,
Trint
I figured it out. After the dataGridView2 is bound with the select
statement, THAT is when
to make the "unnamed" columns visible=false.

Here is the code:
bindingSource1.DataSource = GetData("Select id, parent_id, name FROM
categories where parent_id = '" + dgData1 + "' and active = 1 order by
sort_order asc");
dataGridView3.DataSource = bindingSource1;
dataGridView3.Visible = true;
//this.dataGridView3.DataSource = ds.Tables[0];
this.dataGridView3.Columns[0].Visible = false; //id
this.dataGridView3.Columns[1].Visible = false; //
parent_id

Trint

May 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: charles | last post by:
Hi: I created a thread from Page_Load to start an infinite loop to monitor the arrived data (a customized event). When the data arrives, I set a flag to true to break the loop and join the...
2
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
10
by: pauljohns353 | last post by:
Hi, I am new to VB.net programming and was wondering if anybody has any suggestions as to how I can export data from a DataGridView via a command button to a CSV file. Any suggestions or sample...
2
by: vbt | last post by:
I am new to using the DataGridView and I have read most everything I can find on this subject. But obviously I am not see the hole picture. I am trying to update a data base using the...
5
by: Joe | last post by:
does anyone have any clue??
2
by: Joe | last post by:
and how can I initiate this object without it (I don't use it)
1
by: trint | last post by:
Hi, I have a dataGrid that when I try to add a row, I can't keep the data separated into columns. Here is what I tried to separate the columns (a coma): string completeProductsString = new...
9
by: =?Utf-8?B?UGV0ZXJX?= | last post by:
I have a TabControl on a Windows form in which I have various tab pages each with a DataGridView, the first column of which is a DataGridViewCheckBoxColumn and subsequent columns being...
2
by: ing.Zeco | last post by:
I need usage possibility when I double click on any row in datagridview, that row must be copied in second datagridview. Any good link about that?!
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
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...

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.