C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » Windows »

Adding datagridviewimagecouumn dynamically


Posted Date: 07 Nov 2009      Posted By: AJESH KUMAR CD      Member Level: Silver     Points: 1   Responses: 1



Hello friends,
i want to add a datagridviewimagecoulumn dynamically to the
datagridview in datagrid in windows form. i want to get the image for each
row also dunamically.

can anyone help me in this regard.
please send me the sample code.

regards
AJESH





Responses

Author: Pannalal Sinha    07 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

If the datagridview is databound to an underlying datatable then add the new row to the datatable and bind the datagridview again.

DataTable dt=new DataTable();//global declaration

dt=GetDatabaseRecords();
BindGrid(dt);

void BindGrid(DataTable table1)
{
DataGridView1.DataSource=table1;
}

void AddRow()
{
DataRow dr = dt.NewRow();
dr["id"] = "id";
dr["name"] = "name";
dr["image"] = "image"];
dt.Rows.Add(dr);

BindGrid(dt);
}

Thanks
Panna



Post Reply
You must Sign In to post a response.
Next : SQL statement not filling table for time period of "24/10/2009" to "30/10/2009"
Previous : The first record of the Combobox should be blank at runtime
Return to Discussion Forum
Post New Message
Category: Windows

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use