You did not understand, you are still inheriting from WebPart. IWebPart is an interface already implemented in WebPart so it makes no sense to specify IWebPart in your example.
Don't start with SampleWebPart as it is a server control not a user control.
Just add a UserControl (.ascx) to your web project the usual way. So you will have SomeControl.ascx and SomeControl.ascx.cs. Look in the SomeControl.ascx.cs file and you will see
public class SomeControl : UserControl
change that to
public class SomeControl :UserControl, IWebPart
then implement the requirements for IWebPart
#region IWebPart Members
private string m_title = String.Empty;
private string m_subTitle = String.Empty;
private string m_description = String.Empty;
private string m_titleUrl = String.Empty;
private string m_titleIconImageUrl = String.Empty;
private string m_catalogIconImageUrl = String.Empty;
// Title
public string Title
{
get
{
return m_title;
}
set
{
m_title = value;
}
}
// Subtitle
public string Subtitle
{
get
{
return m_subTitle;
}
set
{
m_subTitle = value;
}
}
// Description
public string Description
{
get
{
return m_description;
}
set
{
m_description = value;
}
}
// TitleUrl
public string TitleUrl
{
get
{
return m_titleUrl;
}
set
{
m_titleUrl = value;
}
}
// TitleIconImageUrl
public string TitleIconImageUrl
{
get
{
return m_titleIconImageUrl;
}
set
{
m_titleIconImageUrl = value;
}
}
// CatalogIconImageUrl
public string CatalogIconImageUrl
{
get
{
return m_catalogIconImageUrl;
}
set
{
m_catalogIconImageUrl = value;
}
}
#endregion
Now you will have a UserControl which implements IWebPart and can be used as a WebPart and contain other UserControls
Hope it helps,
Joe
ps, a good place to get help with WebParts is the
WebParts forum on asp.net