This is a migrated thread and some comments may be shown as answers.

Button Click Event

2 Answers 50 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Celeste Zietsman
Top achievements
Rank 2
Celeste Zietsman asked on 05 Apr 2011, 03:10 PM
Hi

I have created a button in code like this:

 

 

Dim RadRibbonBarGroup_Main = New RadRibbonBarGroup()

 

 

 

 

Dim RadRibbonBarButtonGroup_Main = New RadRibbonBarButtonGroup

 

 

 

Dim btnExtract As New RadButtonElement()

 

 

RadRibbonBarGroup_Main.Items.AddRange(

 

New Telerik.WinControls.RadItem() {RadRibbonBarButtonGroup_Main})

 

 

RadRibbonBarGroup_Main.Name =

 

"RadRibbonBarGroup_Main"

 

RadRibbonBarGroup_Main.Text =

 

"Extract Data"

 

RadRibbonBarGroup_Main.Alignment =

 

ContentAlignment.TopCenter

 

 

btnExtract.Name =

 

"btnExtract"

 

btnExtract.Text =

 

"Extract"

 

btnExtract.Class =

 

"ButtonElement"

 

btnExtract.Image =

 

Global.culminTelFormLib.My.Resources.Resources.Database_export_32()

 

 

btnExtract.ImageAlignment = System.Drawing.

 

ContentAlignment.MiddleCenter

 

 

btnExtract.TextImageRelation = System.Windows.Forms.

 

TextImageRelation.ImageAboveText

 

 

RadRibbonBarButtonGroup_Main.Items.AddRange(

 

New Telerik.WinControls.RadItem() {btnExtract})

 

 

RadRibbonBarButtonGroup_Main.Name =

 

"RadRibbonBarButtonGroup_Main"

 

RadRibbonBarButtonGroup_Main.Text =

 

"RadRibbonBarButtonGroup_Main"

 

RadRibbonBarButtonGroup_Main.Alignment =

 

ContentAlignment.TopCenter

 

 

 

 

Me.tabHome.Items.Insert(0, RadRibbonBarGroup_Main)

 



Now I want to use the click event. How would I go about doing this?

I have tried adding the following code to the form but it still does not work. What am I doing wrong?:

Public WithEvents btnExtract As Telerik.WinControls.UI.RadButtonElement


 

 

Protected Sub btnExtract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExtract.Click

 

 

 

 

If IsNothing(frmLoad) Then

 

frmLoad =

 

New frmTaxSageLoad

 

frmLoad.Show()

frmLoad.WindowState =

 

FormWindowState.Maximized

 

 

 

 

Else

 

frmLoad.BringToFront()

 

 

End If

 

 

 

End Sub

 


Thanks
Celeste

2 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 06 Apr 2011, 10:42 AM
Hello,

To create the click event handler you can manually add a handler to the button. For more information on AddHandler, please refer to this MSDN link

Hope that helps
Richard
0
Celeste Zietsman
Top achievements
Rank 2
answered on 06 Apr 2011, 12:43 PM
Hi Richard

Thanks, I got it working now.

Regards
Celeste
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Celeste Zietsman
Top achievements
Rank 2
Answers by
Richard Slade
Top achievements
Rank 2
Celeste Zietsman
Top achievements
Rank 2
Share this question
or