473,776 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to add comboboxes in the first row of datagridview.

Hi all,
I have to add comboboxes in the first row of datagridview for
mapping the database fields.
For e.g. I have to show Id, FirstName, LastName in each comboboxes in
the first row. if i select a database which contains 2 fields then
this data should be displayed from second row so that the user can
choose the header name for this two columns from comboboxes like Id,
FirstName, LastName etc.
Can anybody tell me the solution?
Thanks,
Ashish Taralekar.

Apr 11 '07 #1
2 1767
One way to try to do this is to use the DataGridView in VirtualMode,
setting this property to true and not setting the DataSource property.
Then in the CellValueNeeded event, you can dynamically provide the
information necessary for your first row, and then for row 2 on, you
can provide values from your DataSource. You will likely have to
handle CellValuePushed as well, and also set the rowcount and column
count appropriately. It will take a little coding to get things
working.

=============== =======
Clay Burch
Syncfusion, Inc.

Apr 11 '07 #2
On Apr 11, 5:32 pm, "ClayB" <c...@syncfusio n.comwrote:
One way to try to do this is to use the DataGridView in VirtualMode,
setting this property to true and not setting the DataSource property.
Then in the CellValueNeeded event, you can dynamically provide the
information necessary for your first row, and then for row 2 on, you
can provide values from your DataSource. You will likely have to
handle CellValuePushed as well, and also set the rowcount and column
count appropriately. It will take a little coding to get things
working.

=============== =======
Clay Burch
Syncfusion, Inc.

Hi Clay,
I tried to implement datagridview in virtualmode and written the
code to add comboboxcolumns into the DataGridView1_C ellValueNeeded
event but when i debug this code then the control is not going into
this event. I am not getting when this event will fire.
Thanks,
Ashish Taralekar.

Apr 11 '07 #3

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

Similar topics

0
1942
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set to and the source object is the subform. My subform record source is a query from another table (vacationTbl). FYI: I was filtering on the subform, but removed it and replaced with
6
1267
by: Sam | last post by:
Hi, I have a datagrid which has (amongst other stuff) 2 comboboxes columns. So far so good. The trick is that when I select a value in my first column, it must updates the items of the combobox in the second column for the same row. In the first column, comboboxes contain names of tables. In the second column, comboboxes contain names of the fields in the table selected in the first column.
1
1080
by: Sam | last post by:
Hi, Databound comboboxes in a datagridview control, are not editable! Therefore if I want to let my user adding a value which is not part of the list, it wouldn't work! Is there a work around? Has anyone come across this problem before? Thx
0
967
by: rsimlote | last post by:
I have a datagridview with 5 comboboxes. After selecting choices in the first row, when the user move on to or enter into the combobox in the next row, the selection from the previous row displays (as selected value). The user assumes that as the selected value and may move on. However once he leaves the combobox, the selectedindex is -1, and hence nothing is selected. I am still trying to figure out how can I set the selected value to -1,...
5
2057
by: jjsavage | last post by:
Hi all, I've got a DataGridView bound to a DataTable, and I need to make some of the columns into ComboBoxColumns. I've tried some of the solutions listed here, but I can't seem to make them work. They might not be the solutions I'm looking for; I just want to have a few arbitrary values for a combo box and make sure everything in that row is one of those values. My boss won't let me just leave them as text boxes. How do I tell the...
0
2305
by: Matt Pegg | last post by:
Hi all, I want be able to enable and disable navigation buttons when on the first or last row of a DataGridView object. I have a populated DataGridView and two buttons - "First Row" and "Previous Row". If the user clicks "First Row", they are taken to the first row in the DataGridView via: Private Sub btnFirstRecord_Click(...) ' Move to first record in job list
2
1862
by: ReneMarxis | last post by:
Hello can anyone tell me if its possible to have mixed colum-types inside one colum in a Datagridview under Net 2.0? I need to have comboboxes (with different content), inputfields and DateTimePicker inside one column depending on some flag on the DataRow. I am not using databinding.
1
2781
by: Arved Sandstrom | last post by:
This seems to be something so simple that none of the hundred-odd tutorials and forum threads that I have looked at (:-)) apparently thinks it's a problem. In a nutshell, I have two DataGridViews. Each has a BindingSource (and a BindingNavigator). The first view populates successfully based upon a Linq to SQL query in the Form Load (that is, the query is assigned to the DataSource of that view's BindingSource, and the BindingSource is...
5
9106
by: bill | last post by:
When you retrieve records to diplay in a DataGridView control the first record has the background highlighted even though no row is yet selected. Does anyone know a way to suppress this first record highlighting after pulling the records into the grid?
0
9628
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
9464
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
10292
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...
1
10061
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
9923
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6722
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
5368
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
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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

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.