windows form control property? - vb.net

Good day everyone,
I just want to ask how to do this on vb.net using vs2010
It's like a label(i'm not sure if it's really a label), like this
and when you put the cursor on it, it will show a "button"?.. like this,

The Control to create the menu is called a toolstrip:
Tutorial for this:
Tooltrips - basics
.Net Heaven
To add those labels when hovering above it, you must use a tooltip.
There is a built in option (that doesn't require an extra control)
Tutorial: MSDN- How to: Use ToolTips in ToolStrip Controls
But you could implement the behavior yourself using the control "tooltip".
Here's some tutorials on how to implement it:
Tooltips
.Net Heaven
Dotnetperls
Enjoy

Related

Reparent controls from a .NET form to VB6

Good morning. I've got an interop .NET form that I can create and show inside a VB6 project. Now, I would like to open the form in "MDI mode". I've got a control that allows me to achieve this result. Unfortunatly it seems to work only with standard VB6 forms. So, the test I would like to try is to copy the content of the .NET form inside the VB6 one... Do you have any suggestion on how to deal with this situation?
Thank you!
The way you are doing this is asking for trouble - it's a bit hacky. It would be better to use supported mechanisms as far as possible.
You would be better off if you create a .NET UserControl with the GUI you want to display, and make it COM visible. You then can instantiate the control in a VB6 form, which would fully support the way that MDI is supported in VB6.

Exposing a Custom Control to Coded UI Tests - WinForms

I wrote my own custom control in WinForms. It's actually works like a TextBox, but have other methodes and extra properties that I wrote.
I tried writing a very simple coded UI test for this control but faild. Every Time I select it with the Coded UI Test Builder it is shown as "Client" and not as a textbox. I cannot read or write to the text property of this control, or get or set other properties.
Do you know how do I expose my custom control for testing, and getting and setting all of it properties?
It is difficult to answer the question without looking at your implementation of the custom control but you can use the following link to learn how to extend a treeview control to make it code UI enabled.
http://www.ranorex.com/blog/enabling-automation-by-adding-accessibility-to-windows-forms-controls
I used that example to learn how to extend my own controls.

Visual Studio Shortcut to Auto-Add Event Delegate Methods

In C# adding event handler methods is very easy. You just type "object.event +=" and then press tab twice.
Is there anything like this for VB projects?
Note: This is for dynamically created controls or controls that are not declared WithEvents.
You can select the object and the event in the top of the coding window and VB will automatically create the method for handling the event and hooking it up in the designer file. Besides from this there is no such feature available not with Visual Studio nor Resharper.
The C# development team added support for this, but for some reason the VB guys haven't gotten around to it yet, nor has I seen any third party addons doing anything like it.

Creating your own component in vb.net 2008

How do you create your own custom component for vb.net 2008? I want it to simply output to a .dll, not a whole winforms app.
So, here is what I have done so far:
Made a class library project
Added a custom control object
Confused myself badly
Googled it, to no avail
How can I control the component? For example, I want my component to not have a visible design view, I want it to stay below like the stopwatch component and the notifyicon component and such, it is not something to be designed. Then, how do I edit the possible properties a user can control, and make them effect the end result? What do I place the code which powers the component on? The class library file, or something else?
Thanks for your help! I have a whole set of components I am going to create, this will get me going much faster than trial and error.
I think you may want to check some walkthrough on how to create components. Such as this one: Walkthrough: Authoring a Component with Visual Basic. Once you are done with that one, there are more walkthroughs on various related topics, such as how to use design-time support, implementing designers and so on.
OK... This is a really abbreviated example. You should start by basing yous off of an existing .net component.
Public Class MyControl
Inherits DataGridView
'...add your properties/functionality...'
End Class
Then compile the DLL, and add it as a reference to whatever project you are working on. Once added, you can add the controls in the DLL into your toolbox.
This has more instructions on how to modify a UserControl (slightly different from the one above, but it explains well. This is a general explanation.
#comments -
Yes, there, are things that will do what you want. Start with a class that inherits Form instead of DataGridView in the example I gave you, and the changes described in the links provided.
"Your properties and functionality" is whatever you want to do that the base control does not do.

Sharepoint form layout in VB

OKay, I'm from a PHP background, but I've just been tasked with developing some custom Web Parts in SharePoint. I've figured out how to create and deploy a basic "Hello world" web part in VB. Okay so far.
What I'm stuck on is a really basic, stupid point - how the hell do I lay out things in a VB web part?
For an example, here's a label and a textbox:
protected overrides sub createchildcontrols()
mybase.createchildcontrols
dim mylabel as new label
dim mytextbox as new textbox
mylabel.text ="My label text"
mytextbox.text ="My textbox"
me.controls.add(mylabel)
me.controls.add(mytextbox)
How would I, for example, get mylabel and my textbox to appear on different lines, rather than running one after the other as they do now? In PHP I'd just wrap them in some top break them onto differnt lines, but how do I do it here?
There are a number of ways to go about it. The easiest, if you really just want the controls to appear on different lines would be to add an ASP.net LiteralControl with a BR tag between them.
Aside from that, you can always use the ASP.net formatting controls, like Table to break your controls into sections for output.
Additionaly, everything that derives from WebControl has an Attribues and CssClass property for setting formatting based on style-sheets you can use.
The last method, and the most customizable, but hardest to maintain and change, would be to override the webpart's Render method and generate your HTML completely by hand in the WebPart.
Alternately, you could scrap this altogether, and employ the SmartPart to develop ASP.net user controls for use inside of SharePoint, giving you the options to use the Visual Studio designer tools to layout your controls on the form.
You should override the Render() method. By default this method just renders all the child controls you have added in the CreateChildControls() method, but overriding it lets you write additional HTML elements around the controls.
I usually code in C#, but I think the following example should work in VB:
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
writer.Write("<h1>Custom webpart rendering</h1>")
me.mylabel.RenderControl(writer)
writer.Write("<br />")
me.myTextbox.RenderControl(writer)
End Sub
Give it a try...
I've been developing web parts for an ASP.NET site using the standard web user control model, which gives you access to the VS designer and means your UI can be standard HTML. ASP.NET then wraps the UserControl into a GenericWebPart at runtime to host it in a WebParts site.
I know that Sharepoint doesn't support this model out of the box but I've just found this which might help you...
http://weblogs.asp.net/jan/archive/2006/12/02/announcing-the-return-of-the-smartpart.aspx
Smart Part (or a variation of it) is the easiest way to go. Why mess with rendering direct html when you can develop a user control more easily?
Plus if you are not an expert in VB, having Visual Studio Designer will help with creating user controls
i blogged about this very topic. Easily build a rich UI for a web part without using SmartPart
Thanks for all the responses. I've gone with EvilGoatBobs solution as the most immediately easy to implement.
This is my first time on StackOverflow and your helpful answers have made it a really good introduction to the site! :)