ComboBox and Datagridview

C

Christian

Hello, i have a datagrid with some columns... the last column is a
ComboBox with 2 items: "yes" and "no"...
i'd like when i select a value "yes" the color's column became
Yello....
someone have an idea....
thanks a lot!
 
I

Ignacio Machin ( .NET/ C# MVP )

Hello, i have a datagrid with some columns... the last column is a
ComboBox with 2 items: "yes" and "no"...
i'd like when i select a value "yes" the color's column became
Yello....
someone have an idea....
thanks a lot!

Hi,

When the selected value change handle the event and change the color
of the parent control
soething like
void changed_color(object sender, Eventargs e)
{
ComboBox c = sender as Combobox;
c.Parent = c.selectedvalue;

}
 
S

Saimvp

Hello Christian. Good Day.

Try this code.

if (grid.CurrentRow.Cells[0].Value == "YES")
{
MessageBox.Show("YES");
}
else
{
MessageBox.Show("NO");
}

Hope can help you
 
C

Christian

Hi,

When the selected value change handle the event and change the color
of the parent control
soething like
void changed_color(object sender, Eventargs e)
{
ComboBox c = sender as Combobox;
c.Parent = c.selectedvalue;

}

Hi Ignacio,
when i debug your code i have the same error:"Cannot implicitly
convert type 'object' to 'System.Windows.Forms.Control'. An explicit
conversion exists".
i don't understand where i put the cast and the type of cast that i
must use...

thaks
Christian
 
C

Christian

Hello Christian. Good Day.

Try this code.

if (grid.CurrentRow.Cells[0].Value == "YES")
{
MessageBox.Show("YES");
}
else
{
MessageBox.Show("NO");
}

Hope can help you

--
To be Happy is To be Yourself

Christian said:
Hello, i have a datagrid with some columns... the last column is a
ComboBox with 2 items: "yes" and "no"...
i'd like when i select a value "yes" the color's column became
Yello....
someone have an idea....
thanks a lot!

Hi Saimvp,
i try your code but seem doesn't work.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top