473,471 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DatagridView comboboxcolumn - assign cell value

I need help to set selected value of combobox column in DGV.

I went this far then got stuck on what to do next:.
How do I set "selected Value" of comboboxpayCode to value of column PayCode
? That is earningCode = payCode.
I can't find .selectedValue in DatagridView ComboboxColumn .

Thanks

Bill

-------------------------
col = .Columns.Add("pCode", "Code")

..Columns(col).Width = 60

..Columns(col).DataPropertyName = "payCode"' Dim comboboxPaycode As New
DataGridViewComboBoxColumn()

..Columns.Insert(4, comboboxPaycode)

..Columns(4).Width = 120

..Columns(4).HeaderText = "Code Desc"

With comboboxPaycode

..DataSource = dCombo.Tables(0)

..ValueMember = "earningCode"

..DisplayMember = "codeDescript"

End With
Jun 27 '06 #1
2 16137
Bill,

Your question sounds strange for me, you can have thousands of comboboxes in
your datagrid (as you have thousand rows. Do you mean that they should be
all set to a defaultvalue. If it is a new one than just set the value in the
datarow, so it will be automaticly binded to the corresponding value.

Cor

"Bill nguyen" <bi*****************@jaco.com> schreef in bericht
news:eV**************@TK2MSFTNGP02.phx.gbl...
I need help to set selected value of combobox column in DGV.

I went this far then got stuck on what to do next:.
How do I set "selected Value" of comboboxpayCode to value of column
PayCode ? That is earningCode = payCode.
I can't find .selectedValue in DatagridView ComboboxColumn .

Thanks

Bill

-------------------------
col = .Columns.Add("pCode", "Code")

.Columns(col).Width = 60

.Columns(col).DataPropertyName = "payCode"' Dim comboboxPaycode As New
DataGridViewComboBoxColumn()

.Columns.Insert(4, comboboxPaycode)

.Columns(4).Width = 120

.Columns(4).HeaderText = "Code Desc"

With comboboxPaycode

.DataSource = dCombo.Tables(0)

.ValueMember = "earningCode"

.DisplayMember = "codeDescript"

End With

Jun 27 '06 #2
Cor;
I guess my question is not clear. I found the answer to it by setting
..DataPropertyName property

Thanks for your help, as usual.

Bill
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
Bill,

Your question sounds strange for me, you can have thousands of comboboxes
in your datagrid (as you have thousand rows. Do you mean that they should
be all set to a defaultvalue. If it is a new one than just set the value
in the datarow, so it will be automaticly binded to the corresponding
value.

Cor

"Bill nguyen" <bi*****************@jaco.com> schreef in bericht
news:eV**************@TK2MSFTNGP02.phx.gbl...
I need help to set selected value of combobox column in DGV.

I went this far then got stuck on what to do next:.
How do I set "selected Value" of comboboxpayCode to value of column
PayCode ? That is earningCode = payCode.
I can't find .selectedValue in DatagridView ComboboxColumn .

Thanks

Bill

-------------------------
col = .Columns.Add("pCode", "Code")

.Columns(col).Width = 60

.Columns(col).DataPropertyName = "payCode"' Dim comboboxPaycode As New
DataGridViewComboBoxColumn()

.Columns.Insert(4, comboboxPaycode)

.Columns(4).Width = 120

.Columns(4).HeaderText = "Code Desc"

With comboboxPaycode

.DataSource = dCombo.Tables(0)

.ValueMember = "earningCode"

.DisplayMember = "codeDescript"

End With


Jun 27 '06 #3

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

Similar topics

10
by: rob | last post by:
I have a class that among others exposes a string property "Date". The date in this property is stored in the form yyyymmdd. Now I do the following 1) Generate a DataGridViewTextBoxColumn column...
1
by: news.microsoft.com | last post by:
Hello, I've got a "simple" problem with the datagridview in VS2005. I am trying to use a unbound datagridview with a ComboBoxColumn. The datagridview with the ComboBoxColumn is configurered at...
2
by: Greg | last post by:
I've populated all the cells in a combo box column with values from 1 - 50 using the following code: foreach (DataGridViewRow row in uxTabSummary.Rows) { DataGridViewComboBoxCell cell =...
8
by: | last post by:
I am sure this has been asked and answered, but here goes anyway... VS.Net 2005, VB.Net How can you display more than one field in the displaymember property of a combobox inside the...
8
by: Brian Pelton | last post by:
This is on .Net 2.0 in a WinForms application. I have a DataGridView that is bound to a BindingSource. The DataGridView has 3 columns. The first two are "normal" text columns and the last is a...
0
by: Andrus | last post by:
I tried to use modeless picklist for DataGridView custom ComboBoxColumn without success. Steps to reproduce issue: 1. Run code 2. Enter some character 3. Press Tab Observed:
18
by: Andrus | last post by:
Marc, Thank you very much. I have issue on implementing add row properly using this. User presses down arrow in last row in grid starting adding new row. Then user changes its mind desiding...
0
by: hydro123 | last post by:
I am using VC++2008 and am trying to read data enetered in unbound datagridview to implement in function. Under button_click event I entered the following: // initialize varaibles from...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
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
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,...
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
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.