Hello,
I've got a Form which has a dataGrid on it. In one of the columns of the
dataGrid, I've implemented a ComboBox using a DataGridComboBoxColumn Class.
I've also over ridden the other columns with a custom DataGridTextBoxColumn
class so I can color certain columns.
What I'm trying to do is.based on the selection in the ComboBox, I want to
color certain cells.
The problem I'm having is.when I make a selection in the ComboBox, the
_SelectedIndexchanged event for the DataGridComboBoxColumn class fires like
it should. At this point, when it fires, I'm in the DataGridComboBoxColumn
class, not in the main Form class. The only way I know of to reference the
main form is to instantiate a new class like.
MyForm myform = new MyForm();
But when I do this, I loose the state (session) data.
When this _SelectedIndexchanged (ComboBox) fires, I need a way to get back
into the main Form code so I can change the colors of certain columns.
I think there is a way to do this, I just don't know how.
Thanks for any help... 4 3050
Randy,
The DataGridComboBoxColumn shouldn't be able to hook to the main form
like that. Rather, why not attach the form to the events on the data source
itself (the dataset) and detect when that column changes? When that
happens, you can set the color appropriately on the grid.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Randy" <te**@temp.com> wrote in message
news:OU**************@TK2MSFTNGP10.phx.gbl... Hello,
I've got a Form which has a dataGrid on it. In one of the columns of the dataGrid, I've implemented a ComboBox using a DataGridComboBoxColumn Class. I've also over ridden the other columns with a custom DataGridTextBoxColumn class so I can color certain columns.
What I'm trying to do is.based on the selection in the ComboBox, I want to color certain cells.
The problem I'm having is.when I make a selection in the ComboBox, the _SelectedIndexchanged event for the DataGridComboBoxColumn class fires like it should. At this point, when it fires, I'm in the DataGridComboBoxColumn class, not in the main Form class. The only way I know of to reference the main form is to instantiate a new class like.
MyForm myform = new MyForm();
But when I do this, I loose the state (session) data.
When this _SelectedIndexchanged (ComboBox) fires, I need a way to get back into the main Form code so I can change the colors of certain columns.
I think there is a way to do this, I just don't know how. Thanks for any help...
That sounds good...but I'm not sure how to do it. You got any examples?
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl... Randy,
The DataGridComboBoxColumn shouldn't be able to hook to the main form like that. Rather, why not attach the form to the events on the data source itself (the dataset) and detect when that column changes? When that happens, you can set the color appropriately on the grid.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Randy" <te**@temp.com> wrote in message news:OU**************@TK2MSFTNGP10.phx.gbl... Hello,
I've got a Form which has a dataGrid on it. In one of the columns of the dataGrid, I've implemented a ComboBox using a DataGridComboBoxColumn Class. I've also over ridden the other columns with a custom DataGridTextBoxColumn class so I can color certain columns.
What I'm trying to do is.based on the selection in the ComboBox, I want to color certain cells.
The problem I'm having is.when I make a selection in the ComboBox, the _SelectedIndexchanged event for the DataGridComboBoxColumn class fires like it should. At this point, when it fires, I'm in the DataGridComboBoxColumn class, not in the main Form class. The only way I know of to reference the main form is to instantiate a new class like.
MyForm myform = new MyForm();
But when I do this, I loose the state (session) data.
When this _SelectedIndexchanged (ComboBox) fires, I need a way to get back into the main Form code so I can change the colors of certain columns.
I think there is a way to do this, I just don't know how. Thanks for any help...
Randy,
Well, you have the data set available to you that you bind to the grid,
right? Just find the table in the collection exposed by the Tables property
on the data set, then attach to the ColumnChanged or ColumnChanging event.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Randy" <te**@temp.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... That sounds good...but I'm not sure how to do it. You got any examples?
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Randy,
The DataGridComboBoxColumn shouldn't be able to hook to the main form like that. Rather, why not attach the form to the events on the data source itself (the dataset) and detect when that column changes? When that happens, you can set the color appropriately on the grid.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Randy" <te**@temp.com> wrote in message news:OU**************@TK2MSFTNGP10.phx.gbl... Hello,
I've got a Form which has a dataGrid on it. In one of the columns of the dataGrid, I've implemented a ComboBox using a DataGridComboBoxColumn Class. I've also over ridden the other columns with a custom DataGridTextBoxColumn class so I can color certain columns.
What I'm trying to do is.based on the selection in the ComboBox, I want to color certain cells.
The problem I'm having is.when I make a selection in the ComboBox, the _SelectedIndexchanged event for the DataGridComboBoxColumn class fires like it should. At this point, when it fires, I'm in the DataGridComboBoxColumn class, not in the main Form class. The only way I know of to reference the main form is to instantiate a new class like.
MyForm myform = new MyForm();
But when I do this, I loose the state (session) data.
When this _SelectedIndexchanged (ComboBox) fires, I need a way to get back into the main Form code so I can change the colors of certain columns.
I think there is a way to do this, I just don't know how. Thanks for any help...
Thanks a bunch!...that works just like I need it to. I hadn't thought of
that...
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ux**************@TK2MSFTNGP14.phx.gbl... Randy,
Well, you have the data set available to you that you bind to the grid, right? Just find the table in the collection exposed by the Tables property on the data set, then attach to the ColumnChanged or ColumnChanging event.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Randy" <te**@temp.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... That sounds good...but I'm not sure how to do it. You got any examples?
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Randy,
The DataGridComboBoxColumn shouldn't be able to hook to the main form like that. Rather, why not attach the form to the events on the data source itself (the dataset) and detect when that column changes? When that happens, you can set the color appropriately on the grid.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Randy" <te**@temp.com> wrote in message news:OU**************@TK2MSFTNGP10.phx.gbl... Hello,
I've got a Form which has a dataGrid on it. In one of the columns of the dataGrid, I've implemented a ComboBox using a DataGridComboBoxColumn Class. I've also over ridden the other columns with a custom DataGridTextBoxColumn class so I can color certain columns.
What I'm trying to do is.based on the selection in the ComboBox, I want to color certain cells.
The problem I'm having is.when I make a selection in the ComboBox, the _SelectedIndexchanged event for the DataGridComboBoxColumn class fires like it should. At this point, when it fires, I'm in the DataGridComboBoxColumn class, not in the main Form class. The only way I know of to reference the main form is to instantiate a new class like.
MyForm myform = new MyForm();
But when I do this, I loose the state (session) data.
When this _SelectedIndexchanged (ComboBox) fires, I need a way to get back into the main Form code so I can change the colors of certain columns.
I think there is a way to do this, I just don't know how. Thanks for any help...
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gamze |
last post by:
Hi,
In my vb.net windows application ,i have combobox which is populated by
sqlserver database table.When i select value from combobox ,value saved in to
other table of my database
and i use to...
|
by: Bill C. |
last post by:
Hello,
I know this has been discussed a lot already because I've been searching
around for information the last few weeks.
I'm trying to implement a DataGridComboBoxColumn class. I've found...
|
by: john sutor |
last post by:
Does anyone know how to create a combobox in a standard datagrid? I can
create check boxes , but not the combobox
|
by: PeterZ |
last post by:
G'day,
After doing much searching and pinching bits of ideas from here there and
everywhere I came up with a fairly 'clean' solution of including a comboBox
into a dataGrid column.
You can...
|
by: pei_world |
last post by:
I want to implement a key hit with enter to dropdown a combobox that is in
the datagrid. in this case I need to override its original behaviours. I
found some codes from the web. Does anyone know...
|
by: TT (Tom Tempelaere) |
last post by:
Hay there,
I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one
(I hope .NET 2.0 supplies one). I based it on this article:...
|
by: John Doe |
last post by:
Now i know how to manually add a combobox to a datagrid,
but how would i handle the recordset below?
ID | FirstName | LastName | Job
--------------------------------
1 |Joe | Smith |...
|
by: dbuchanan |
last post by:
ComboBox databindng Problem
== How the ComboBox is setup and used:
My comboBox is populated by a lookup table. The ValueMember is the
lookup table's Id and the DisplayMember is the text from a...
|
by: fiaolle |
last post by:
Hi
The first set of source code is the class for a combobox in a grid,
hopefully. In the second set of code we try to use the combobox class, but
the grid is empty.
I don't understand how this...
|
by: JJGarcia |
last post by:
Hi Everyone,
I'll try to explain the process I'm following, I'm new to this so I'm
triying the easy way first, probably the lasyest too!
I created a new Project, drag in to it a SQLConnection,...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |