In the last step you created a new application and added Button and C1TaskDialog controls. You also customized the appearance and behavior of the C1TaskDialog control. In this step you'll add code to complete an action when the Command Link buttons are click and to open the dialog box when the button on the form is clicked at run time.
Complete the following steps:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.C1TaskDialog1.Show()
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void button1_Click(object sender, EventArgs e)
{
this.c1TaskDialog1.Show();
}
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub C1TaskDialog1_ButtonClick(ByVal sender As System.Object, ByVal e As C1.Win.C1Win7Pack.TaskDialogButtonClickEventArgs) Handles C1TaskDialog1.ButtonClick
If e.DialogResult = TaskDialogResult.[Custom] Then
Select Case e.CustomButton.Name
Case "Button1"
System.Diagnostics.Process.Start("https://www.grapecity.com/en/docs")
e.Cancel = True
Exit Select
Case "Button2"
System.Diagnostics.Process.Start("https://www.grapecity.com/en/forums")
e.Cancel = True
Exit Select
Case "Button3"
System.Diagnostics.Process.Start("https://www.grapecity.com/en/support/contact")
Exit Select
e.Cancel = True
End Select
End If
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void c1TaskDialog1_ButtonClick(object sender, TaskDialogButtonClickEventArgs e)
{
if (e.DialogResult == TaskDialogResult.Custom)
{
switch (e.CustomButton.Name)
{
case "Button1":
System.Diagnostics.Process.Start("https://www.grapecity.com/en/docs");
e.Cancel = true;
break;
case "Button2":
System.Diagnostics.Process.Start("https://www.grapecity.com/en/forums");
e.Cancel = true;
break;
case "Button3":
System.Diagnostics.Process.Start("https://www.grapecity.com/en/support/contact");
break;
e.Cancel = true;
}
}
}
|
|
In this step you added code to your application to customized and initialized the C1TaskDialog control. In the next step you'll run the application to view some of the possible run-time interactions.