473,663 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combobox in datagrid, again...

Hi,

In Windows Forms the usual approach to add a combobox in a datagrid involves
adding a single combobox to the DataGrid.Contro ls, and then selectively
displaying it as needed when a combobox cell becomes the currentcell.
However I'm looking for a way to add a control to a cell in each row from
the actually set up and source binding of the datagrid. I'd like to have the
combobox visible at all times (kind of hard to know that one can change the
values otherwise), the mentioned approach hides the only combobox once the
cell loses focus, to have it ready for display on the next cell that get
focus.

Does anyone have an article about something like this or have a few hints on
how this could be achieved?

Richard
Nov 16 '05 #1
1 1690
If you have implemented your own DataGrid column extending the
TemplateColumn, you can allways paint an inexistent dropdown using the
System.Windows. Forms.ControlPa int.DrawComboBu tton( .... )

method.

"Richard Hallgren" <ri*******@drea mforce.se> schrieb im Newsbeitrag
news:e1******** ******@TK2MSFTN GP12.phx.gbl...
Hi,

In Windows Forms the usual approach to add a combobox in a datagrid involves adding a single combobox to the DataGrid.Contro ls, and then selectively
displaying it as needed when a combobox cell becomes the currentcell.
However I'm looking for a way to add a control to a cell in each row from
the actually set up and source binding of the datagrid. I'd like to have the combobox visible at all times (kind of hard to know that one can change the values otherwise), the mentioned approach hides the only combobox once the
cell loses focus, to have it ready for display on the next cell that get
focus.

Does anyone have an article about something like this or have a few hints on how this could be achieved?

Richard

Nov 16 '05 #2

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

Similar topics

3
3024
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 download a fully working C# sample with the Northwind.mdb here: www.insightgis.com.au/web/stuff/DataGridCombo.zip
3
6824
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: http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx I have a problem when there are two DataGrid's on one form, and when I switch focus from one grid to the other. To be more precise, when I'm editing a combo box column in one grid, and then click in the combo column of...
0
1607
by: AR | last post by:
I have a datagrid containing a single combobox column. It also contains an 'Add New Row' button at the bottom of the datagrid. The datagrid is in a form that contains 'Save' and 'Restore' buttons. The 'Save' button saves all the data from the dataset to the database. The 'Restore' button resets the datagrid to the values contained in it at the last 'Save' operation. When I have 3 entries (rows) populated within the datagrid. If I delete...
12
1423
by: Lars Netzel | last post by:
I have, in earlier projects, had som serious problems with ComboBoxColumns in a datagrid. And now I'm in a projects where I needs sometthing like that again.. but I really do not want to work with Datagrid in Windows.Form cause they are buggy and ComboBoxes are not easy to work with there (especially not when you need Multi Columns in the Comboboxes as well). Is there a better way or a better object to use when doing this sort of stuff?...
3
917
by: Art | last post by:
Hi, Forgive me for posting this message in 2 groups -- it appears that the Data Access group isn't very active, so I'm posting again here: I have a DataTable that I want to fill using a DataGridView. I've set the DataSource of the DataGridView to my DataTable. My problem is that I want some of the columns to be drop downs. For example, the user will need to enter a "product" into one of the columns. There is a list of "products" in...
1
2091
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 works. The first set of code I downloaded from internet and when i tried it, it worked fine. But when I changed the second part of the code it started to give me trouble. Before I changed the code they used Datacolumns,Datarows and Datatables and...
2
3136
by: mfleet1973 | last post by:
Hello (again), Within my datagrid I add a control to the datagridtextboxcolumn when the underlying textbox receives focus as follows: Combobox1.Size = New Size(Datagrid1.GetCurrentCellBounds().Width + 3, combobox1.Size.Height) sender.Controls.Add(Combobox1) This works great. The problem is that when focus is set on the
4
1811
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, configured, dragged an Dataadapter per each table I need it, then generated the dataset, after that, I stablished the relations between tables, then, went over to the datasources, choose the parent datasource and clicked on the + sign, it...
10
2027
by: Doug Bell | last post by:
Hi I am still having problems with Tabbing through a DataGrid with a DataGridComboBox Column. I need to allow the User to Type the value into the ComboBox so consequently its ComboBoxStyle is set to DropDown. This causes the Tabbing to work incorrectly. Even though I am consuming the Windows Message WM_KEYUP, it still Tabs through the ComboBox Column on to the next Column. I found if I do not give the keyboard focus ie remark out...
0
8435
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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...
1
8547
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7368
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
6186
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
5655
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
4181
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...

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.