VB.Net UI is missing - vb.net

I'm using Visual Studio 2012 to make a Vb.Net application.
In short, I added DotNetBar RibbonControl with some RibbonItems on it as my menu.
What happened is one of my tab is suddenly missing along with all the buttons in it.
I have searched for it on my Document Outline still no luck.
But what even more odd is, when I tried to recreate it with the same name, it shows an Alert "Property value is not valid" with message "The name AppPOButton is already in use by another component".
When I checked it on the form's Designer I do found this lines:
Me.AppPOButton = New DevComponents.DotNetBar.ButtonItem()
and
'AppPOButton
'
Me.AppPOButton.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText
Me.AppPOButton.Image = Global.ProjectBMT.My.Resources.Resources.approval
Me.AppPOButton.ImageFixedSize = New System.Drawing.Size(40, 40)
Me.AppPOButton.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top
Me.AppPOButton.Name = "AppPOButton"
Me.AppPOButton.SubItemsExpandWidth = 14
Me.AppPOButton.Text = "Approve"
Me.AppPOButton.Visible = False
and
Friend WithEvents AppPOButton As DevComponents.DotNetBar.ButtonItem
Is there anyone can explain why this is happening?
Thank you

This behavior is weird itself, but it's not a problem actually, All the Ribbon style works on "Containers", if you check your ribbon control and click the left-upper button will see these little arrows that move four containers, these objects hold the buttons, images and other controls. Within your design window in the right panel (Properties) you can still see the names of the controls you "lost" when you deleted your tab, wich is also a container.
Steps:
Add a container within your design view and Dock it into the Ribbon control Form.
Click on the uppper right boton (Right Arrow) and select "Layout Ribbon", this will adjust the lenght and hight of the controls conatained.
Add the tab that will contain all the controls you have.
The fact that they are still in the designer form is the prove that they still exist, This behavior is just a glitch in the position and order of the controls set above your form ;-)

Related

Having a problem with visual studio Databinding when leaving and coming back to the same form

For making this simply I have two forms a button on each to navigate between the two forms. Then on one I have a checkbox and label when the checkbox is checked it displays the label by using the following code in the form.load event:
Me.label1.DataBindings.Add("Visible", Me.checkbox1, "Checked")
The problem is if I were to leave the form with the checkbox and label and the checkbox is not checked and then I come back to the form with the checkbox and try and check it the label doesn't show up any suggestions or solutions.
Delete that line of code from the form load
Open your form in the designer, the one with the label and the checkbox on it
Click the checkbox
In the Properties grid expand (PropertyBinding) and open the drop down next to (none), click New at the bottom
Pick an initial value, and choose a name for the setting. Make it user scoped if you want to be able to save it and restore it next time the program opens
Now go to your label, properties, click the [...] next to (PropertyBinding) to see a list of all bindable properties, scroll to Visible and drop down to choose the same setting
Run the program.
Side note; when I did this I think I may have encountered a bug/feature of databinding (that I plan to research more) in that the behavior was only as expected if the bool starts out as true (so the control is visible) when the binding is set up. If the control is invisible, it never binds properly to see when the property has become true - so as a workaround (purely in this case where we're binding Visible), replace he call to InitializeComponent() with this, in the form's constructor:
if (!Properties.Settings.Default.FormatWithoutConfirmation)
{
Properties.Settings.Default.FormatWithoutConfirmation = true;
InitializeComponent();
Properties.Settings.Default.FormatWithoutConfirmation = false;
}
else
InitializeComponent();

How can a ContextMenuToolStripItem be displayed, without doing it programmatically?

I've taken over a project, which contains some UltraWinGrid controls on some of the forms.
On one of the original forms which has been there since before I took on the project, there is a ContextMenuStrip, which has just one ContextMenuToolstripItem on it, captioned 'Default for Column'.
This ContextMenuStrip is hidden by default, however, when the user right-clicks on the UltraGrid, the ContextMenuStripItem is displayed on the grid (rather than at the top of them form where the ContextMenuStrip is).
I'm trying to replicate this behaviour in a new form that I've added myself, however, after adding the ContextMenuToolstripItem in, I cannot get it to display when right-clicking my grid.
I've put a breakpoint on every subroutine in the in the older forms class, and none of them are triggered when right-clicking it.
Additionally I have also searched the class for DefaultForColumnToolstripMenuItem, and the only place it appears is in the Click event of the ContextMenuToolStripItem itself.
So, how else is it possible to show it when right-clicking the grid? I've copy and pasted the ContextMenuStrip from the old form onto the new form and still nothing occurred.
I'm assuming it's in a property somewhere that I'm missing?
Check for a ContextMenuStrip property on the UltraWinGrid. You can set it in the designer and your context menu will appear on right click without having to deal with the MouseClick handler, checking the mousebutton used, etc.

Checkbox with image and autosize

In Word 2012 I have seen the following checkbox:
I am wondering if this checkbox is a .NET control with an image assigned to it (with property "imagealign" being middle right) or if this is a custom solution by MS for their Office GUIs.
I can reproduce the appearance, but I am unable to easily check if the user clicks the checkbox (and wants to change its state) or the info button and wants to show the tooltip.
Also, I have to add some spaces at the end of the checkbox text, else the image is under the text if the checkbox autosize property is set to True.
I would tend to think that the checkbox is a custom solution by MS or perhaps the image is a separate control.
Does anybody know more about this?
I think you are looking for
Checkbox.AutoSize = False
CheckBox.Image = "Your Image"
CheckBox.ImageAlign = MiddleRight
But this way you won't be able to distinguish if the user clicks the checkbox or the info button to show the tooltip.
As far as I know, there is no control available at .NET which allows this behavior, so I suppose they are using separate controls.
I think you'll need to use a PictureBox near the CheckBox and then use CheckBox_CheckedChanged and PictureBox_Click events to do whatever you want on each case.

vb.net textbox that won't let me highlight text

I'm working on an upgrade of a VB6 winforms project to VB.Net 2.0. On one form (and only this one form, out of about 25), my text boxes are acting odd.
When a user clicks into (focuses on) a textbox with a value in it, the cursor automatically goes to the beginning (left side) of the textbox and can only be moved with the keyboard arrow keys. I can't re-position the cursor with the mouse, and I can't highlight a section of text with the mouse.
The text box is not readonly and is both visible and enabled. In fact all settings are default as I've dragged out a new textbox and added it to the form and I get the same behavior.
Any ideas would be greatly appreciated.
OK, here is answer:
The startup form was set as an MdiContainer. This form had a split panel container that held another form for Application controls in panel 1 and the working forms in panel 2. When the working forms were loaded into panel 2, they weren't allowed to be top level as there was a .Parent attribute set to the split container panel 2. For some reason, the highlighting of text in a text box is disallowed unless the textbox is on a top level form, and since we couldn't get the working form to top level, we couldn't highlight the text. For reference, check this out.

How to stop my tools strip menu items from appearing in the taskbar?

I have a program which runs mainly though a NotifyIcon in the bottum right of my windows screen (XP). Whenever I open the ContextMenuStrip that appears when the icon is right clicked, a box also appears in the task bar. I also have nested menus inside the menu (mouse over one item leads to another menu), and each additional menu also creates a taskbar box upon appearing. So once I am at the third or fourth nested menu, there would be 3 or 4 windows appearing in the taskbar. After the menu disapears, so do the windows in the taskbar.
How can I stop the taskbar from displaying boxes to represent these menus? I have done nothing in my code as far as I know to create this type of behavior. I have searched for similar problems but have found nothing similar. There is no "showintaskbar" property for these items as far as I can see, and no other property that I can find which would affect this. I have investigated the owner of the contextmenustrip since I read the owner may effect these type of behaviors, but that doesnt seem to be helpful as there isn't an owner property of the contextmenustrip.
I don't know what else to search for, so I am here hoping someone can give me a clue as to what else may effect this type of behavior.
Any help is greatly appreciated. Thank you!
If you are using the ContextMenuStrip.Show() method, it will display in the taskbar as you describe. Try assigning your menu to the NotifyIcon.ContextMenuStrip property instead.