Brad R

Im looking at examples, am using C Sharp 2005. Made an Access database that has description, name, value

Trying to initialize variables with the values from a column. all it will be is when it runs, to take a foreach column has data in Row[x] and take the 15 global variables in my program and assign them to the corresponding entries in the colum marked "value"

the other columns are for the human to reference, but one are integers that the program needs, THANKS




Re: Windows Forms Data Controls and Databinding How to get at the dataGridView data ?

Bob zhu - MSFT

Hi:

for example c# work with access you can see follow link

http://www.csharphelp.com/archives/archive70.html






Re: Windows Forms Data Controls and Databinding How to get at the dataGridView data ?

Brad R

Hi Bob thanks for answering but I couldnt find the way to address the exact datagrid item from that example

Thought it was like

string str = datagridview1.Item(Row[0], Col[0]).ToString();

since the datagridview has the data can I just reference IT or do I reference the source of the datagridview






Re: Windows Forms Data Controls and Databinding How to get at the dataGridView data ?

Brad R

okay maybe I finally figured it out, I tried to get it from the dataset, instead of the datagridview this seems to work:

label8.Text = dataSet1.DATAVALUES.Rows[4].ItemArray.GetValue(4).ToString();






Re: Windows Forms Data Controls and Databinding How to get at the dataGridView data ?

Brad R

okay found another issue/problem

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)

{

textBox3.Text = e.ColumnIndex.ToString();

textBox4.Text = e.RowIndex.ToString();

Not every cell in the datagridview returns a value. some clicks do nothing. seems arbitrary like this built in method does not work

I just did a double click from design view of the datagridview and got this, then added the textbox3 and 4 to show whats inside e. sometimes the clicked cell shows up the col/row value, sometimes the click doesnt change anything.






Re: Windows Forms Data Controls and Databinding How to get at the dataGridView data ?

Bob zhu - MSFT

yes, for example this fired for checkedboxcolumn but would not be fired for textboxcolumn

for textboxcolumn, you can use cellclick






Re: Windows Forms Data Controls and Databinding How to get at the dataGridView data ?

Bob zhu - MSFT

for your question about address item in cell,

for example it is Textboxcolumn, you can use

string a=dataGridView2[ColumnIndex,RowIndex].Value.ToString()