|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DatagridView comboboxcolumn - assign cell valueI 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 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 Show quoteHide quote "Bill nguyen" <billn_nospam_please@jaco.com> schreef in bericht news:eV31PYamGHA.1912@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 > > 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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:ep5F6hbmGHA.3752@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" <billn_nospam_please@jaco.com> schreef in bericht > news:eV31PYamGHA.1912@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 >> >> > >
Controling Event Sequencing...
dataset and where clause Dataset HasChanges function not true when Dataset is passed as variable button flash with red and white color Dates at Midnight How to detect datagrid row change [Regular Expression] match a word with interpunctuation Getting saved values back to display after Update Not 'breaking' or executing statments. VB2003 dll Used in VB2005` |
|||||||||||||||||||||||