private void MenuViewSourceClick(object sender, EventArgs e) { if (listMessages.SelectedNode != null) { int messageNumber = GetMessageNumberFromSelectedNode(listMessages.SelectedNode); Message m = messages[messageNumber]; // We do not know the encoding of the full message - and the parts could be differently // encoded. Therefore we take a choice of simply using US-ASCII encoding on the raw bytes // to get the source code for the message. Any bytes not in th US-ASCII encoding, will then be // turned into question marks "?" ShowSourceForm sourceForm = new ShowSourceForm(Encoding.ASCII.GetString(m.RawMessage)); sourceForm.ShowDialog(); } }