473,407 Members | 2,629 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,407 software developers and data experts.

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 16136
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.