данные с грида

strizzz
Дата: 25.05.2006 18:14:42
int currentRowIndex = GridCont.CurrentRow.Index;
label1.Text = DataGridView1[currentRowIndex, 0];


выдаёт ошибку: Cannot implicitly convert type 'System.Windows.Forms.DataGridViewCell' to 'string'

Извиняюсь за глупый вопрос, но в тупике.
strizzz
Дата: 25.05.2006 18:22:52
автор
int currentRowIndex = DataGridView1.CurrentRow.Index;
label1.Text = DataGridView1[currentRowIndex, 0];
из тупика
Дата: 25.05.2006 18:27:43
А если предположить что это 'System.Windows.Forms.DataGridViewCell' имеет метод ToString()?
Да и 2003 возвращался тип object насколько я помню
strizzz
Дата: 25.05.2006 18:52:08
а как скажем 'System.Windows.Forms.DataGridViewCell' в int перегнать. тут 2005?
strizzz
Дата: 25.05.2006 18:59:23
int currentRowIndex = GridCont.CurrentRow.Index;
textBox1.Text = GridCont[currentRowIndex, 0].ToString();


выдал текстбокс вот чего:

DataGridViewTextBoxCell { ColumnIndex=0, RowIndex=0 }

а мне бы значение..
Goster
Дата: 26.05.2006 10:01:57
А что если попробовать:
text = (string)DataGridView1.Rows[rownum].Cells[collnum].Value;
strizzz
Дата: 26.05.2006 17:45:26
спс, но

на

string msg = (string)GridCont[currentRowIndex, 0].Value;

стал ругаться "When casting from the number, the value must be a number less than infinity", после того как происходит событие.

только перешел с VB на с#. видать с типами не до конца разобрался.
GD162
Дата: 30.05.2006 23:36:35
попробуй так:
label1.Text = DataGridView1[currentRowIndex 0].Value.ToString();
Nomem
Дата: 07.06.2006 09:23:49
или так
int currentRowIndex = DataGridView1.CurrentRow.Index;

Label1.text= (string)dvgPressForms.Rows[currentRowIndex ].Cells[0].Value;