But now there is a new look:
Visit Microsoft Download Center Beta!
SqlConnection _objCon = new SqlConnection(_strConnectionString);
SqlCommand _objCmd = new SqlCommand();
System.Data.DataSet _objDataSet = new System.Data.DataSet();
_objCmd.Connection = _objCon;
_objCmd.CommandType = System.Data.CommandType.StoredProcedure;
_objCmd.CommandText = "uspAnyDll";
SqlParameter _paramSelectType = new SqlParameter("@selectType", System.Data.SqlDbType.VarChar);
SqlParameter _paramWhereValue = new SqlParameter("@WhereValue", System.Data.SqlDbType.VarChar);
_paramSelectType.Value = _SQL;
_paramWhereValue.Value = _WhereSQL;
_objCmd.Parameters.Add(_paramSelectType);
_objCmd.Parameters.Add(_paramWhereValue);
SqlDataAdapter _objAdapter = new SqlDataAdapter(_objCmd);
_objAdapter.Fill(_objDataSet);
ddlThis.DataSource = _objDataSet;
ddlThis.DataTextField = "Value";
ddlThis.DataValueField = "ID";
ddlThis.DataBind();
if (allowSelectionByUserValue != null)
{
System.Web.UI.WebControls.ListItem
_listItem = new System.Web.UI.WebControls.ListItem(allowSelectionByUserValue, "0");
_listItem.Selected = true;
ddlThis.Items.Add(_listItem);
}
if (this.SelectedValue != null)
{
ddlThis.SelectedValue = this.SelectedValue;
}
}
else
{
//Throw Expression
}
}
}
Private WithEvents btn1 As Office.CommandBarButtonPrivate Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
End Sub
Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ShutdownEnd Sub
End Class
Dim explorer As Outlook.Explorer = Me.Application.ActiveExplorer()And declare Button click event any where in the class.If explorer IsNot Nothing Then
Dim bar As Office.CommandBar = explorer.CommandBars.Add("saAction Bar", Temporary:=True)
bar.Visible = True
btn1 = bar.Controls.Add(Office.MsoControlType.msoControlButton, Temporary:=True)btn1.Caption = "saAction Button"
btn1.Tag = "myOutlookAddin1.btn1"
btn1.Style = Office.MsoButtonStyle.msoButtonCaption
End If
Private Sub Btn1_Click(ByVal ctrl As Office.CommandBarButton, ByRef cancelDefault As Boolean) Handles btn1.ClickMsgBox("Hi! this is VSTO")
End Sub
public interface myInterFace1it have two methods. Operation and myName.
{
void Operation(string myParam);
string myName();
}
class ProgramNow, lets inherit with interface.
{
}
class Program:myInterFace1Now I'm using myInterFace1 in Program class, So I need to write down all methods of that interface in my class.
{
}
All method of that interface will be write down there in that class automatically.
class Program:myInterFace1
{
static void Main(string[] args)
{
}
#region myInterFace1 Members
public void Operation(string myParam)
{
throw new Exception("The method or operation is not implemented.");
}
public string myName()
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
}