Load theme in VB.net

Feb 25, 2013 at 6:09 AM
Hi there. I'm not familiar with C and I would like to ask for your help to convert the code below to VB.net. Any help would be appreciated. TIA

private void LoadThemeXml()
{
string content = System.IO.File.ReadAllText("C:\\MyTheme.xml");
((RibbonProfessionalRenderer)ribbon1.Renderer).ColorTable.ReadThemeXmlFile(content);
ribbon1.Refresh();
}
Feb 25, 2013 at 2:58 PM
The RibbonDemo ThemeBuilderForm de-compiled as VB.net code:
Private Sub btLoadFile_Click(sender As Object, e As EventArgs)
    Dim openFileDialog As OpenFileDialog = New OpenFileDialog()
    openFileDialog.Multiselect = False
    openFileDialog.Filter = "ini or xml|*.ini;*.xml"
    If openFileDialog.ShowDialog() = DialogResult.OK Then
        Me.txtThemeFile.Text = openFileDialog.FileName
        Dim text As String = File.ReadAllText(openFileDialog.FileName)
        Dim extension As String = Path.GetExtension(openFileDialog.FileName)
        If extension.ToLower() = ".ini" Then
            (CType(Me.ribbon1.Renderer, RibbonProfessionalRenderer)).ColorTable.ReadThemeIniFile(text)
        Else
            If extension.ToLower() = ".xml" Then
                (CType(Me.ribbon1.Renderer, RibbonProfessionalRenderer)).ColorTable.ReadThemeXmlFile(text)
            End If
        End If
        Me.LoadTheme()
    End If
End Sub
Feb 26, 2013 at 2:24 AM
Great! will try this and give a feedback. Hopefully there will be more tutorials for VB.net here... this is a great tool by the way! =)