Posted 20 years ago by KenA
Avatar
Hi ... I need some help in converting the PasteCode.aspx VB to C#

== VB.net =================================
string key
if( !Page.IsPostBack )
{
CodeHighlighterConfiguration config = CType( ConfigurationSettings.GetConfig("codeHighlighter"), CodeHighlighterConfiguration);

foreach( key in config.LanguageConfigs.Keys )
{
LanguageDropDownList.Items.Add(key);
}
}
===================================

Ken A.

Comments (2)

Posted 19 years ago by Marianne
Avatar
This is C#.

------------------------------- Marianne

Posted 18 years ago by Andrey Niedens
Avatar
There is the C# code:

protected void Page_Load(object sender, EventArgs e)
{
if(!this.IsPostBack)
{
CodeHighlighterConfiguration config = (CodeHighlighterConfiguration)ConfigurationSettings.GetConfig("codeHighlighter");
foreach(string key in config.LanguageConfigs.Keys)
{
this.LanguageDropDownList.Items.Add(key);
}
}
}

protected void HighlightButton_Click(object sender, EventArgs e)
{
//Disable the button
this.HighlightButton.Enabled = false;

//Update labels
this.FileSizeLabel.Text = CodeTextBox.Text.Length.ToString();
OutputTextBox.Text = "";

//Set the language key
Highlighter.LanguageKey = LanguageDropDownList.SelectedItem.Text;

//Set whether to allow outlining and line numbering
Highlighter.OutliningEnabled = this.OutliningEnabledCheckBox.Checked;
Highlighter.LineNumberMarginVisible = this.LineNumberMarginVisibleCheckBox.Checked;

//Set the code to the highlighter
Highlighter.Text = CodeTextBox.Text;

//Show the results panel
ResultsPanel.Visible = true;
}
The latest build of this product (v4.0.59) was released 13 years ago, which was after the last post in this thread.