DataGridView is Bind But Not displayed
I am making Winforms application. I have put gridview in usercontrol. Which is another 开发者_如何转开发control.
public long FileID
{
get { return _FileID; }
set
{
_FileID =value;
BindGridView();
}
}
Here I am setting property values and binding gridview , I am getting records in Messagebox too, but I cant find Gridview. Help me. Thanks.
private void BindGridView()
{
if (_FileID!= 0)
{
srHstyFiles = new dms_client.History_Files.History_FilesSoapClient();
DataTable dt;
dt = srHstyFiles.GetHistoryRevisionfile(_FileID);
gvHstoryRev.DataSource = dt;
gvHstoryRev.Refresh();
gvHstoryRev.Parent.Refresh();
MessageBox.Show(gvHstoryRev[1,2].values.tostring());
}
}
If you have drag and drop user control and you are making new object and try to set property then your grid view wouldn't bind any way.
When ever user control dropped c# generate automatic instance of user control of its name.
Example
ParentControl.ChildControl.FileID = id;
精彩评论