16,022,542 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by jeremy12341234 (Top 16 by date)
jeremy12341234
16-May-12 12:24pm
View
Deleted
@Mewara: Hi Sandeep, the best possible solution I can think of is to have two different non-bound DataGridViewComboBoxColumns. I could use one as a "DisplayMember" and when that cell changes or cell end edits it could change the index to what would be a non-visible DataGridViewComboBoxColumn (ValueMember) to the same index.
What do you think? or do you know of any other boards or places that might know the answer.
Thanks!
jeremy12341234
15-May-12 13:04pm
View
I have created a solution and a database as a starting point example:
http://www.armadasoftwaresolutions.com/flagshipt.zip
I am populating the datagridview in an unorthodox manner. Maybe this is the reason:
public main()
{
InitializeComponent();
dgv1.DataError += new DataGridViewDataErrorEventHandler(dgv1_DataError);
DataGridViewComboBoxColumn cbCol = new DataGridViewComboBoxColumn();
cbCol.DefaultCellStyle.NullValue = "--Select--";
cbCol.FlatStyle = FlatStyle.Popup;
cbCol.DataSource = new functions_sqls().select("select distinct l.list_value vm, l.long_description dm from lists l where liststypesid = 5");
cbCol.DisplayMember = "dm";
cbCol.ValueMember = "vm";
dgv1.Columns.Add(cbCol);
DataTable mySelect = new functions_sqls().select("select top 5 p.lt_unit_of_measure_product from products p");
int irow = 0;
foreach (DataRow dr in mySelect.Rows)
{
dgv1.Rows.Add();
dgv1.Rows[irow].Cells[0].Value = int.Parse(dr[0].ToString());
irow++;
}
}
private void dgv1_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
}
jeremy12341234
15-May-12 12:36pm
View
It displays the value member instead of the display member but when you click on the combobox in the datagrid it displays the display member. When you choose one of the display members and leave the datagridviewcombobox it displays the first displaymember but does not retain any new value.
jeremy12341234
15-May-12 12:31pm
View
I will not shout anymore. I will do anything you ask for a solution. I have been coding with databound comboboxes with C# for 6 years and databound comboboxes with other languages for at least 14 years. This is not my question.
jeremy12341234
15-May-12 12:29pm
View
The actual main code is:
new ov().add_ddl(this.Name, dgv1.Name, "products", "lt_unit_of_measure_product", "select l.list_value vm, l.long_description dm from lists l where l.liststypesid = 5 order by 2");
new ov().add_write(this.Name, dgv1.Name, "products", "lt_unit_of_measure_product");
new ov().add_setwidth(this.Name, dgv1.Name, "all", "all");
new ov().add_hide(this.Name, dgv1.Name, "usersidm");
new ov().add_hide(this.Name, dgv1.Name, "datetimem");
new functions_dgv().get("f",dgv1,this.Name,"products",false,false,false,"select '','',productsid,usersidm,datetimem,lt_unit_of_measure_product from products");
dgv1.DataError += new DataGridViewDataErrorEventHandler(dgv1_DataError);
Inside functions_dgv().get:
default:
sql1 = "";
sql1 = new ov().ovag("get", new object[] { "ddl", pFormName, pDGV.Name, pTable, Col.ToString() }).ToString();
if (sql1 != "")
{
DataGridViewComboBoxColumn cbCol = new DataGridViewComboBoxColumn();
cbCol.ValueType = System.Type.GetType("System.Int32");
cbCol.DefaultCellStyle.NullValue = "--Select--";
cbCol.FlatStyle = FlatStyle.Popup;
cbCol.DataPropertyName = "dpn";
cbCol.DataSource = new functions_sqls().select(sql1);
cbCol.DisplayMember = "dm";
cbCol.ValueMember = "vm";
cbCol.Name = Col.ToString();
pDGV.Columns.Add(cbCol);
}
else
{
DataGridViewTextBoxColumn dfCol = new DataGridViewTextBoxColumn();
dfCol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
dfCol.Name = Col.ToString();
pDGV.Columns.Add(dfCol);
}
break;
It displays the value member instead of the display member but when you click on the combobox in the datagrid it displays the display member. When you choose one of the display members and leave the datagridviewcombobox it displays the first displaymember but does not retain any new value.
jeremy12341234
15-May-12 12:27pm
View
My question has been rated to 1 so I will probably not receive anymore responses. If I ask the question again I am sure it will be rated as 1.
I will do anything you ask to make this work!
Do you know what board I should ask this question?
jeremy12341234
15-May-12 12:23pm
View
I have been coding for years with regular bound comboboxes. The is a datagridviewcomboboxcolumn.
datagridviewcomboboxcolumn
jeremy12341234
15-May-12 12:22pm
View
@Mewara. The code I provided should work but it is not.
It displays the value member instead of the display member but when you click on the combobox in the datagrid it displays the display member. When you choose one of the display members and leave the datagridviewcombobox it displays the first displaymember but does not retain any new value.
I am shouting because you are not replying using the code I provided as a specifically ask.
The question was straight forward but I am asking for a code example using the code provided NOT conceptually understanding comboboxes with displaymembers and valuemembers and datasources.
It is a datagridviewcombobox NOT a combobox.
Please reply to the question using the code provided is straight forward I agree.
jeremy12341234
15-May-12 11:56am
View
PLEASE REPLY TO THIS QUESTION USING THE CODE PROVIDED.
jeremy12341234
15-May-12 11:56am
View
When people get a first reply to a question the question is rarely read anymore because it is assumed to be resolved.
Mewara? Why did you reply without answering the question?
PLEASE REPLY TO THIS QUESTION USING THE CODE PROVIDED.
I HAVE WENT THROUGH THE DOCUMENTATION. I HAVE TRIED EXAMPLES. I WOULDN'T BE ASKING THE QUESTION IF I HAD WENT THROUGH DOCUMENTATION AND IT WORKED.
jeremy12341234
15-May-12 11:52am
View
Deleted
It displays the value member instead of the display member but when you click on the combobox in the datagrid it displays the display member. When you choose one of the display members and leave the datagridviewcombobox it displays the first displaymember but does not retain any new value.
This is why I am asking for an example.
jeremy12341234
15-May-12 11:49am
View
PLEASE DO NOT RESPOND WITHOUT A DATAGRIDVIEWCOMBOBOX EXAMPLE IN A DATAGRIDVIEW USING THE CODE PROVIDED.
jeremy12341234
15-May-12 11:47am
View
How could you not understand this:
PLEASE REPLY TO THIS QUESTION USING THE CODE PROVIDED.
jeremy12341234
15-May-12 11:45am
View
Deleted
PLEASE REPLY TO THIS QUESTION USING THE CODE PROVIDED.
jeremy12341234
15-May-12 11:45am
View
I understand that part completely. I have been using that for over 6 years for regular comboboxes. It is not working in my datagrid.
PLEASE REPLY TO THIS QUESTION USING THE CODE PROVIDED.
jeremy12341234
15-May-12 7:38am
View
Deleted
That example doesn't help me. Can someone please look at the code I initially provided and yield a solution.
The actual main code is:
new ov().add_ddl(this.Name, dgv1.Name, "products", "lt_unit_of_measure_product", "select l.list_value vm, l.long_description dm from lists l where l.liststypesid = 5 order by 2");
new ov().add_write(this.Name, dgv1.Name, "products", "lt_unit_of_measure_product");
new ov().add_setwidth(this.Name, dgv1.Name, "all", "all");
new ov().add_hide(this.Name, dgv1.Name, "usersidm");
new ov().add_hide(this.Name, dgv1.Name, "datetimem");
new functions_dgv().get("f",dgv1,this.Name,"products",false,false,false,"select '','',productsid,usersidm,datetimem,lt_unit_of_measure_product from products");
dgv1.DataError += new DataGridViewDataErrorEventHandler(dgv1_DataError);
Inside functions_dgv().get:
default:
sql1 = "";
sql1 = new ov().ovag("get", new object[] { "ddl", pFormName, pDGV.Name, pTable, Col.ToString() }).ToString();
if (sql1 != "")
{
DataGridViewComboBoxColumn cbCol = new DataGridViewComboBoxColumn();
cbCol.ValueType = System.Type.GetType("System.Int32");
cbCol.DefaultCellStyle.NullValue = "--Select--";
cbCol.FlatStyle = FlatStyle.Popup;
cbCol.DataPropertyName = "dpn";
cbCol.DataSource = new functions_sqls().select(sql1);
cbCol.DisplayMember = "dm";
cbCol.ValueMember = "vm";
cbCol.Name = Col.ToString();
pDGV.Columns.Add(cbCol);
}
else
{
DataGridViewTextBoxColumn dfCol = new DataGridViewTextBoxColumn();
dfCol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
dfCol.Name = Col.ToString();
pDGV.Columns.Add(dfCol);
}
break;
Show More