Hello All, I hope someone can help. I have a dataGridView populated with data, I have added a dataGridViewComboBoxColumn. The dataGridViewComboBoxColumn is populated per row. That all works great. The issue I am having is getting the value of a dataGridViewComboBoxColumn Cell. The last thing I tired is: DataGridViewComboBoxCell cell = dataGridView1[cntR, cntC] as DataGridViewComboBoxCell; string val = cell.ValueMember.ToString(); string val2 = cell.Value.ToString(); Which always returns "" for both. Any help would really be great. j
jasper018
Posts
-
How to get dataGridView ComboBoxCell Value -
Set an arrays items to new stringsI do not know if this will work but I know when I use string you have to be careful of slashes and so on so for one you could try: private void LoadSettings() { StreamReader Settings = new StreamReader("Settings.txt"); string line; while ((line = Settings.ReadLine()) != null) { if (line.StartsWith(@"/")) { } else { string[] splitArray = line.Split(new char[] { '=' }); MessageBox.Show(splitArray[0]); } } } The at symbol will ensure it is read as string.... as for getting the strings back together you could use a string builder or just add the values together string var = (splitArray[0] + " = " + splitArray[1]); I am not sure if that is the best way to do it. Hope that helps.
-
Get DataGridView ComboBox Column value??Hello All, I hope someone can help. I have a dataGridView populated with data, I have added a dataGridViewComboBoxColumn. The dataGridViewComboBoxColumn is populated per row. That all works great. The issue I am having is getting the value of a dataGridViewComboBoxColumn Cell. The last thing I tired is: DataGridViewComboBoxCell cell = dataGridView1[cntR, cntC] as DataGridViewComboBoxCell; string val = cell.ValueMember.ToString(); string val2 = cell.Value.ToString(); Which always returns "" for both. Any help would really be great. j
-
Hiding columns in a data grid viewthis is in a win app
-
How to: Radiobutton check event confirmation ???I know there is a AutoCheck propery, the default is set to true, and what that does it when a raido button is checked, it clears all the other raido buttons in the group... I have never used it, but it might be help full, but then you would have to clear the the raido buttons manually on user confirmation...
-
Data grid view question with unbound check box columnThat helped thanks!!
-
How to: Radiobutton check event confirmation ???you could use the CheckedChanged event which is called when the checked property is changed, so that should work for the key board as well as the mouse. hope that helps
-
Data grid view question with unbound check box columnHello, I am not sure how to tackel this, what I have is a data grid view with two columns 1. an unbound check box column and 2. a bound data column. What I want to do is for each check box that is check i want to get the value of the bound column in that same row. what i was thinking is some thing like this: foreach (DataGridViewRow row in datagridview) { if(datagridview.Columns[0] (here is where i am not sure how to see if the check box is checked) { } } any help would be great... Thanks, J
-
Right Align Data Grid View Column and Format Data Grid View Column for moneyThanks!! That worked great!!
-
Close the form programmaticaly.If closing the form is to end the application you could use: Application.Exit();
-
Right Align Data Grid View Column and Format Data Grid View Column for moneyHello, I was wondering if any one can help with right align the text in a data grid view column and formatting a data grid view column for money (eg. $ 100.00) any help would be great. thanks, J
-
Hide Data Grid View Columns 2Thanks for the reply! :o) That did not seem to work either
-
Hide Data Grid View Columns 2Thanks i am going to give that a try!
-
Hide Data Grid View Columns 2answer question 1: when using the (datagrid.columns[i].visible = false) method when the data grid load in the form, the row height is set to 0, even if i reset is before it is displayed it does not change. so there for all the rows appear shrinked. I do not know why this is happening, and no matter what I do, or set, it seems to set the row height to 0. answer question 2: Yes I have posted this question before... the responses I had gotten, though helpfull, did not help with my problem, i am really stumped with this one.
-
Hide Data Grid View Columns 2Hello, Any help would be great! I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data in the data grid view. Even if i set the row height, it seems to make no difference. I need to set which columns are shown in code, and I change the data source for the data grid view as needed. I have also tryed (datagrid.columns[i].width = 0) and (col.width = 0), both produce the same result, the column width is changed to 0, but you can still see the column, only it appears as a line, and if you are hiding a few columns then it is very noticable. Also you can streach the columns with a width of 0 back out again. any help would be great. Thanks to thoes who replyed to my first question for this, I did try all suggestions. thanks, J
-
Hiding columns in a data grid viewThank you for the help, but that does not work. You can see all the columns with a width of 0, they appear as just lines... you can still expand the columns with a width of 0, to see the data. but thanks.
-
Hiding columns in a data grid viewThank you for the help, but that does not work. You can see all the columns with a width of 0, they appear as just lines... but thanks.
-
Hiding columns in a data grid viewHello, Any help would be great! I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data in the data grid view. Even if i set the row height, it seems to make no difference. I need to set which columns are shown in code, and I change the data source for the data grid view as needed. any help would be great. thanks, J
-
Delete Key Trapping?Thanks I am going to give that a try! J
-
Delete Key Trapping?Hello I have a data grid view and when I press the delete key, even though I have a message box to confirm the delete, the delete happens either way. Any ideas on trapping the delete key? thanks j private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) { DialogResult yn = MessageBox.Show("Are you sure you want to delete this row?", "DataGridView Delete", MessageBoxButtons.YesNo); if (yn == DialogResult.Yes) { } if (yn == DialogResult.No) { MessageBox.Show("record was not deleted"); } }