Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Problem regarding toolbar item?
 

Problem regarding toolbar item?

Here i am working with migrating vb6.0 application into vb.net. Here i have written code like this

Private Sub RichTextBox1_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles rtbChart.Enter

If Combobox1.Text <> "XXXX" Then

Toolbar1.Visible = True

If Len(RichTextBox1.Text) Then Toolbar1.Items.Item(0).DisplayStyle = System.Windows.Forms.ToolBarButtonStyle.DropDownButton

End If

End Sub

Here in above code when i am running the dotnet code i am getting the error like this

"The value of argument 'Value'(4) is invalid for enum type 'toolstripitmeDisplaystyle'.

Parameter Name :value"

Here how can i rectify this error. Please give clear information it is very Urgent.

thanks

vsbabu.

Vsbabu  Thursday, August 16, 2007 6:43 AM

Hi Vsbabu,

Based on your post, I know you are using the ToolStrip control. I recommend you can take the two steps.

1. You can use the ToolBar control in Vb.net application. You only need to add this control into "ToolBox".

2. You add the Button control and the DropDownButton control to the ToolStrip control. You can set the Visible property of these controls to determine which control is displayed based on the conditions.

Hope this helps.

Riquel_Dong  Wednesday, August 22, 2007 6:10 AM

Hi Vsbabu,

Based on your code, you don't use the ToolBar control. I think you are using the ToolStrip control and are setting the ToolStripItem.DisplayStyle Property. Itsets whether text and images are displayed on a ToolStripItem. It uses the value in the ToolStripItemDisplayStyle Enumeration . This enumeration is new in the .NET Framework version 2.0. So your code is not properly. You can modify the code based on the ToolStripItemDisplayStyle Enumeration. Hope this helps.

Thanks for your questions.

Riquel_Dong  Tuesday, August 21, 2007 8:26 AM

Sorry for mistake andmany many thanks for your valuable suggestion.

Yes .Here i am using toostrip control in my application . Here i am upgrading vb6.0 application in to vb.net application.here in my previous application (VB6.0) they have written code for displaying the toolbarbutton control as dropdown Button(Toolbarbutton Displaystyle) andas Pushbutton based onone condition.It is possible in toolbar control. because there are only button control ,lablelcontrol ,textbox control and etc.. except Dropdown button control we can add in that toolbar control. But here in DotNet2.0. That toolbar control is changed as toolstrip control . But here in this toolstrip control additionally they add seperate "DropDownbuttoncontrol" as seperate. Here in my application i added one DropdownButton control in my toolstrip control and it is always working as dropdown control in this toolstrip control but here my requirement is this same DropDownButton control should act as Pushbiutton as well as DropdownButton control based on one condition. this is my claear requirement. Please understood this and give some clear calrification for this.

thanks,

vsbabu

Vsbabu  Tuesday, August 21, 2007 1:14 PM

Here i am using toostrip control in my application . Here i am upgrading vb6.0 application in to vb.net application.here in my previous application (VB6.0) they have written code for displaying the toolbarbutton control as dropdown Button(Toolbarbutton Displaystyle) andas Pushbutton based onone condition.It is possible in toolbar control. because there are only button control ,lablelcontrol ,textbox control and etc.. except Dropdown button control we can add in that toolbar control. But here in DotNet2.0. That toolbar control is changed as toolstrip control . But here in this toolstrip control additionally they add seperate "DropDownbuttoncontrol" as seperate. Here in my application i added one DropdownButton control in my toolstrip control and it is always working as dropdown control in this toolstrip control but here my requirement is this same DropDownButton control should act as Pushbiutton as well as DropdownButton control based on one condition. this is my claear requirement. Please understood this and give some clear calrification for this.

thanks,

vsbabu

Vsbabu  Tuesday, August 21, 2007 1:20 PM

Hi Vsbabu,

Based on your post, I know you are using the ToolStrip control. I recommend you can take the two steps.

1. You can use the ToolBar control in Vb.net application. You only need to add this control into "ToolBox".

2. You add the Button control and the DropDownButton control to the ToolStrip control. You can set the Visible property of these controls to determine which control is displayed based on the conditions.

Hope this helps.

Riquel_Dong  Wednesday, August 22, 2007 6:10 AM

You can use google to search for other answers

Custom Search

More Threads

• Access and VB
• Close application from dll?
• unable to convert generic types
• XP SideBar
• Need help with vb.net syntax for passing parameters to stored procedures
• T-SQL: Trigger/Iterating through columns
• Initialize an instance of an own class
• Notification area
• How long a computer is on, and writing after some text
• Getting the connection string for a project