For Each Control... vb net error |
Post Reply |
Author | |
sasa
Newbie Joined: 19 February 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 13 June 2008 at 11:18am |
Hi,
I don't understand where I make mistakes but a simple Dim Ctrl As XtremeCommandBars.CommandBarControl For Each Ctrl In TBar.DesignerControls TBar.FindControl(Ctrl.Id).Caption = "Caption" TBar.FindControl(Ctrl.Id).TooltipText = "TTips" TBar.FindControl(Ctrl.Id).DescriptionText = "aa" Next return me an error in vb.net when Ctrl is an xtpControlButton. The same source code work nice in vb6. If I try to write... Dim Ctrl As XtremeCommandBars.CommandBarControl For Each Ctrl In TBar.DesignerControls Ctrl.Caption = "Caption" Ctrl.TooltipText = "TTips" Ctrl.DescriptionText = "aa" Next ... I have no errors but commandbar don't show new caption and tips value. Where i make mistakes ?? Thanks to all |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Use Actions to change Captions/Description easy.
Add CommandBars.EnableActions before you add any control and
CommandBars.Actions(Id).Caption = "New Caption" to change all buttons with id = "Id".
See Actions sample.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
sasa
Newbie Joined: 19 February 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Hello Oleg,
I receive an error NullReferenceException if I try to use method Actions. Above there is source code: Dim ctrl As Control For Each ctrl In Me.Controls If TypeOf ctrl Is MdiClient Then cmdBarMain.SetMDIClient(ctrl.Handle.ToInt32()) End If Next ctrl With cmdBarMain .LoadDesignerBars(PercorsoApp & "\MainLayout.xcb", Nothing) cmdBarMain(2).ModifyStyle(XtremeCommandBars.XTPCommandBarStyle.XTP_CBRS_GRIPPER, 0) .ActiveMenuBar.Delete() .Options.AlwaysShowFullMenus = True .Options.IconsWithShadow = True .Options.LargeIcons = True .Options.ShowExpandButtonAlways = False .Options.ToolBarAccelTips = True .Options.ToolBarScreenTips = True .Options.UseDisabledIcons = True .Options.SyncFloatingToolbars = True .ToolTipContext.ShowTitleAndDescription(True, XtremeCommandBars.XTPToolTipIcon.xtpToolTipIconInfo) .ToolTipContext.Style = XtremeCommandBars.XTPToolTipStyle.xtpToolTipBalloon .ToolTipContext.MaxTipWidth = 200 .StatusBar.AddPane(0) .StatusBar.AddPane(1) .StatusBar.AddPane(2) .StatusBar.Font.Name = "Tahoma" .StatusBar.Font.Size = 10 .StatusBar.Pane(0).Width = 180 .StatusBar.Pane(0).Style = XtremeCommandBars.XTPStatusPaneStyle.SBPS_NOBORDERS .StatusBar.Pane(1).Width = 40 .StatusBar.Pane(1).Style = XtremeCommandBars.XTPStatusPaneStyle.SBPS_NOBORDERS .StatusBar.Pane(2).Width = 0 ' 0 = Autro Size .StatusBar.Pane(2).Style = XtremeCommandBars.XTPStatusPaneStyle.SBPS_STRETCH + XtremeCommandBars.XTPStatusPaneStyle.SBPS_NOBORDERS .StatusBar.Pane(0).Text = "Ready to use" .StatusBar.Pane(1).Text = "" .StatusBar.Pane(2).Text = "" .StatusBar.Visible = True .EnableCustomization(False) End With cmdBarMain.Actions(ID_ANAGR).Caption = "Something" How can I avoid problem ?? Thanks a lot |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Maybe ID_ANAGR actioin not found. Are you sure in MainLayout.xcb actions are enabled ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
sasa
Newbie Joined: 19 February 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Hi Oleg,
I enabled actions in commandbar but it don't show me what i ask. New source code is: Dim ctrl As Control For Each ctrl In Me.Controls If TypeOf ctrl Is MdiClient Then cmdBarMain.SetMDIClient(ctrl.Handle.ToInt32()) End If Next ctrl With cmdBarMain .LoadDesignerBars(PercorsoApp & "\MainLayout.xcb", Nothing) .EnableActions() cmdBarMain(2).ModifyStyle(XtremeCommandBars.XTPCommandBarStyle.XTP_CBRS_GRIPPER, 0) .ActiveMenuBar.Delete() .Options.AlwaysShowFullMenus = True .Options.IconsWithShadow = True .Options.LargeIcons = True .Options.ShowExpandButtonAlways = False .Options.ToolBarAccelTips = True .Options.ToolBarScreenTips = True .Options.UseDisabledIcons = True .Options.SyncFloatingToolbars = True .ToolTipContext.ShowTitleAndDescription(True, XtremeCommandBars.XTPToolTipIcon.xtpToolTipIconInfo) .ToolTipContext.Style = XtremeCommandBars.XTPToolTipStyle.xtpToolTipBalloon .ToolTipContext.MaxTipWidth = 200 .EnableCustomization(False) End With cmdBarMain.Actions.Add(ID_ANAGR, "CaptionAction", "tooltip action", "descr action", Nothing) cmdBarMain.Actions(ID_ANAGR).Caption = "NewCaption" Dim test As String = cmdBarMain.Actions.Action(ID_ANAGR).Caption in such way, it change Caption property but new caption is not showed when I run program. Where I'm wrong ?? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, Actions have to be enabled in MainLayout.xcb. Open it in designer, select some controls and in propertyPages click "Enable Actions"
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
sasa
Newbie Joined: 19 February 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Thanks... thanks.... thanks.
Now it work nice. Thank you very much Oleg Have a nice day |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
:)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |