Skip to content

Instantly share code, notes, and snippets.

@steefjan
Created August 11, 2010 13:17
Show Gist options
  • Save steefjan/518955 to your computer and use it in GitHub Desktop.
Save steefjan/518955 to your computer and use it in GitHub Desktop.
/// <summary>
/// Event Handler for Send button click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSend_Click(object sender, EventArgs e)
{
//create an instance MessageQueue, which points to the already existing SalesForceCustomer
MessageQueue mq = new MessageQueue(@".\PRIVATE$\SalesForceCustomer");
//Create instance Message
System.Messaging.Message mes = new System.Messaging.Message();
//Instantiated encoding object
UTF8Encoding encoding = new UTF8Encoding();
Byte[] byteArray = encoding.GetBytes(txtAccountDetails.Text);
MemoryStream mem = new MemoryStream(byteArray);
BinaryWriter writer = new BinaryWriter(mem);
mes.BodyStream = writer.BaseStream;
mq.Send(mes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment