We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I customize the controls on the Configuration Editor dialog ?

 

You could selectively show or hide the TabPages and rename the Buttons on the Configuration Editor dialog as shown in the method below.

C#

private frmConfigDialog CustomizeConfigDialog (frmConfigDialog form)

{

foreach (Control ctrl in form.Controls)

{

if (ctrl is Button)

{

Button btn = (Button) ctrl;

if (btn.Text == "&OK")

btn.Text = "&Apply";

}

// Get the TabControl in the ConfigDialog form

else if (ctrl is TabControl)

{

TabControl tabControl = (TabControl) ctrl;

TabPage formatsPage = null;

// Get the Formats TabPage

foreach (TabPage page in tabControl.TabPages)

{

if (page.Text == "Formats")

formatsPage = page;

}

// Clear all TabPages in the TabControl

tabControl.TabPages.Clear();

// Add only the Formats TabPage

tabControl.TabPages.Add(formatsPage);

}

}

return (frmConfigDialog) form;

}

VB

Private Function CustomizeConfigDialog(form As frmConfigDialog) As frmConfigDialog

Dim ctrl As Control

For Each ctrl In form.Controls

If TypeOf ctrl Is Button Then

Dim btn As Button = CType(ctrl, Button)

If btn.Text = "&OK" Then

btn.Text = "&Apply"

End If

' Get the TabControl in the ConfigDialog form

ElseIf TypeOf ctrl Is TabControl Then

Dim tabControl As TabControl = CType(ctrl, TabControl)

Dim formatsPage As TabPage = Nothing

' Get the Formats TabPage

Dim page As TabPage

For Each page In tabControl.TabPages

If page.Text = "Formats" Then

formatsPage = page

End If

Next page ' Clear all TabPages in the TabControl

tabControl.TabPages.Clear()

' Add only the Formats TabPage

tabControl.TabPages.Add(formatsPage)

End If

Next ctrl

Return CType(form, frmConfigDialog)

End Function 'CustomizeConfigDialog

Please refer to the test sample attached below that illustrates this.

Article ID: Published Date: Last Revised Date: Platform: Control:
359 04/30/2011 07/10/2014 Windows Forms EditControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.